Hi
I might have simplified the problem too much...
If my template argument is:
F: < int(double) >
Then I needed to define the type:
boost::function< void(bool, int) >
If my template argument is:
F: < void(double) >
Then I needed to define the type:
boost::function< void(bool) >
But I actually got a pretty reply on stackoverflow, where Partial
specializatio is suggested as an solution:
http://stackoverflow.com/questions/8258267/problems-using-mplif-boostfunctio...
Thanks for the input any way
Regards
Allan W. Nielsen
On Thu, Nov 24, 2011 at 3:26 PM, Max Vasin
Hello, Allan, although I do not know the answer I post some results that I have got. Your problem has nothing to do with either MPL or function_types. First of all declaring function to take a void parameter is deprecated, the type `void (void)' is in fact `void ()'. When you declare a function type void (R) where R depends on a template parameter compiler expects to get an unary function type but when R is void the function is nullary (and turning an unary function into nullary seem to be forbidden). This minimal example demonstates the issue:
template <typename F> struct A { typedef void type(F); };
int main(int argc, const char *argv[]) { A<int> ok; A<void> fail; }
What you need is partial template specialization. And I will wait for the expert answer.
-- WBR, Max Vasin. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users