Working on Windows with VS2005 and struggling to understand the error messages I'm getting. If this question has been asked before, I'm sorry. I couldn't find it.
Class I'm testing:
#include <functional>
using std::unary_function;
template<typename F, typename G>
struct UnaryConvolution : unary_function<typename G::argument_type,typename F::result_type>{
UnaryConvolution(const F &_f, const G &_g) : m_F(_f), m_G(_g){}
result_type operator()(const argument_type &_arg){
return m_F( m_G( _arg ) );
}
F m_F;
G m_G;
};
unit test I've written:
using std::bind2nd;
using std::equal_to;
using std::less;
bool unaryConvolution_test(){
UnaryConvolution obj(bind2nd( equal_to<bool>(), true ), bind2nd( less<int>(), 5 ));
return obj( 3 );
}
and errors I'm getting:
- error C2955: 'UnaryConvolution' : use of class template requires template argument list
- error C3848: expression having type 'UnaryConvolution' would lose some const-volatile qualifiers in order to call '_Result UnaryConvolution::operator ()(const _Arg &)'
- error C2514: 'UnaryConvolution' : class has no constructors
even adding the line int val = 3
and then passing val
has no effect. (BTW, project is forbidden to use Boost or any 3rd party library. Don't ask, I try not to.)