13 Mar
2009
13 Mar
'09
8:48 a.m.
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); }; Roman Perepelitsa.