I'm trying to meter std::function< >
into a std::set< >
. For this, we need a function that compares the values entered.
As std::function
does not provide any comparison operator, I thought about this:
#include <functional>
template< typename... ARGS > class Test {
using function_type = std::function< void( ARGS... ) >;
using target_type = void ( * )( ARGS... );
static inline bool less( const function_type &f1, const function_type &f2 ) noexcept {
std::less< target_type > l;
return l( f1.target< target_type >( ), f2.target< target_type >( ) );
}
};
Test< int, int > test;
When trying to compile
g ++ -std = c ++ 11 -Wall -Wextra -pedantic -c test.cpp
I get a pretty error list:
In static member function
less( ... )
:
error: expected primary-expresion before>
error: expected primary-expresion before)
error: expected primary-expresion before>
error: expected primary-expresion before)
Note: The code is the minimum reproducible. I have kept what I think is important
-
What am I doing wrong?
-
How do I solve it?