|
Boost Users : |
Subject: [Boost-users] Problems using mpl::if_ and function_types::result_type
From: Allan Nielsen (a_at_[hidden])
Date: 2011-11-24 08:25:28
Hi
I'm new to the boost::mpl library, and have some "beginners-problems"
template < typename F >
struct A {
typedef boost::function_types::parameter_types<F> P;
typedef typename boost::function_types::result_type<F>::type R;
typedef typename boost::mpl::if_< boost::is_same< R, void >,
boost::function< void ( void ) > ,
boost::function< void ( R ) > >::type TTT;
A() {
}
};
int main(int argc, const char *argv[])
{
A<int(int, float)> ok; // working
A<void(int, float)> compile_error; // non-working
return 0;
}
xxx.cxx: In instantiation of âA<void(int, float)>â:
xxx.cxx:108:25: instantiated from here
xxx.cxx:100:77: error: invalid parameter type
âboost::mpl::aux::wrapped_type<boost::mpl::aux::type_wrapper<void>
>::typeâ
xxx.cxx:100:77: error: in declaration âA<F>::TTTâ
What is the problem here, and how can I solve it.
To my understanding only the selected part of mpl::if_ should be
evaluated by the compiler....
Regards
Allan W. Nielsen
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net