Boost logo

Boost Users :

Subject: Re: [Boost-users] [mpl] is_constructible_from
From: David Abrahams (dave_at_[hidden])
Date: 2009-03-16 20:32:11


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

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