You can simply && combine the results of these properties and put them in std::integral_constant :
std::integral_constant<bool, std::is_pointer<T>::value && std::is_const<T>::value>
Or you can write a generic attribute and . Some features here :
Option 1 :
template<typename... Conds> struct and_ : std::true_type { }; template<typename Cond, typename... Conds> struct and_<Cond, Conds...> : std::conditional<Cond::value, and_<Conds...>, std::false_type>::type { };
Option 2 :
template<bool...> struct bool_pack; template<bool... bs> using and_ = std::is_same<bool_pack<bs..., true>, bool_pack<true, bs...>>;
When we get the fold expressions , you can do this:
template<typename... Args> using and_ = std::integral_constant<bool, (Args::value && ...) >;
Your compiler may already support this under the flag -std=c++1z , for example this .
Tartanllama
source share