17 Mar
2009
17 Mar
'09
12:32 a.m.
on Fri Mar 13 2009, Roman Perepelitsa <roman.perepelitsa-AT-gmail.com> wrote:
I need a metafunction that returns true iif a type has a constructor with 2 arguments of a given type. Does mpl have it? If not, is it possible to implement?
template <class C, class T1, class T2> struct is_constructible_from;
struct foo { foo(int, int); }; struct bar { bar(int*, int); }; struct baz {};
int main() { assert(is_constructible_from<foo, int, int>::value); assert(is_constructible_from<foo, int, double>::value); assert(!is_constructible_from<bar, int, int>::value); assert(!is_constructible_from<baz, int, int>::value); };
I know of no way to do that. -- Dave Abrahams BoostPro Computing http://www.boostpro.com