Boost logo

Boost Users :

Subject: [Boost-users] [type_erasure] static check of concept compliance
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2016-08-27 14:32:20


Consider:

     using any_t=any<
       boost::mpl::vector<
         copy_constructible<>,
         incrementable<>
>
>;

     struct foo{};

     int main()
     {
std::cout<<std::is_constructible<any_t,foo>::value<<"\n";
     }

This program outputs 1 as the ctor of boost::type_erasure::any<Concept>
if not restricted to
Concept-compliant args, but of course we can't use foo to construct any_t:

     any_t x{foo{}}; // compile error as foo is not incrementable

Is there a (publicly available) way to determine if an argument of type
U can be used to
construct an any<Concept,T>? I'd like to have this for doing SFINAE in
my any-using code.

Thank you,

Joaquín M López Muñoz


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