Skip to content
Snippets Groups Projects
Commit f1216f2e authored by Jan Trávníček's avatar Jan Trávníček
Browse files

simplify algorithm registry code

parent 4aeda06c
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,11 @@ class AlgorithmRegistry {
INCOMPATIBLE
};
 
template < class ParamType >
static ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > convertParamType ( std::string paramName ) {
return ext::make_tuple ( ext::to_string < typename std::decay < ParamType >::type > ( ), abstraction::ParamQualifiers::paramQualifiers < ParamType > ( ), std::move ( paramName ) );
}
template < class ... ParamTypes >
static ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > convertParamTypes ( std::array < std::string, sizeof ... ( ParamTypes ) > paramNames ) {
/* make unused parameter warning go away in case of sizeof ... ( ParamTypes ) == 0 */
......@@ -72,7 +77,7 @@ class AlgorithmRegistry {
ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > params;
 
unsigned i = 0; /* the evaluation order in initializer list is actually defined */
( void ) std::initializer_list < int > { ( params.push_back ( ext::make_tuple ( ext::to_string < typename std::decay < ParamTypes >::type > ( ), abstraction::ParamQualifiers::paramQualifiers < ParamTypes > ( ), std::move ( paramNames [ i ++ ] ) ) ), 0 ) ... };
( void ) std::initializer_list < int > { ( params.push_back ( convertParamType < ParamTypes > ( std::move ( paramNames [ i ++ ] ) ) ), 0 ) ... };
 
return params;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment