c++ - Is-braces-constructible type trait -
how can check whether specific type typename t
constructible arguments typename ...args
in manner t{args...}
? aware of std::is_constructible< t, args... >
type trait <type_traits>
, works parentheses, not curly braces. not have experience in writing of type traits, cannot provide initial example. simplification can accept reasonable assertions, if leads not significant loss of generality.
template<class t, typename... args> decltype(void(t{std::declval<args>()...}), std::true_type()) test(int); template<class t, typename... args> std::false_type test(...); template<class t, typename... args> struct is_braces_constructible : decltype(test<t, args...>(0)) { };
Comments
Post a Comment