[type_erasure] static check of concept compliance

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

AMDG On 08/27/2016 12:32 PM, Joaquin M López Muñoz wrote:
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.
No there isn't. The implementation of a concept is in the body of a function. I don't think there's any way to test it for compliance at compile time without creating another parallel hierarchy solely for the test. In Christ, Steven Watanabe
participants (2)
-
Joaquin M López Muñoz
-
Steven Watanabe