Is there a way to create a vector< mem_fun_t< ReturnType, MyClass > >
?
The error i'm seeing is:
error C2512: 'std::mem_fun1_t<_Result,_Ty,_Arg>' : no appropriate default constructor available
Is there a way to create a vector< mem_fun_t< ReturnType, MyClass > >
?
The error i'm seeing is:
error C2512: 'std::mem_fun1_t<_Result,_Ty,_Arg>' : no appropriate default constructor available
mem_fun_t
meets the requirements to be stored in a container (it is copy-constructible and assignable), so the answer is yes.
However, it isn't default-constructible or comparable, so there are some things you can't do with a container of them, including:
The error you are seeing comes from trying to either resize, or construct with a size.
You certainly can create such a vector.
If you are having problems, read the error message carefully. For example,
std::mem_fun
can return all sorts of wrappers, depending on what you pass to it.Or indeed, switch to boost's or C++0x's
function
.Edit: With this particular error message, I assume that you are doing something that invokes the default constructor for contained type (e.g
resize
or specifying the size with the vector's constructor). You can't use those functions.