For example, I want to use type T
only if std::is_pointer<T>
and std::is_const<T>
evaluate to true_type
.
Of course, there is a simple way like this:
template <typename T>
void f(T t, std::true_type, std::true_type) {}
template <typename T>
void f(T t)
{
f(t, std::is_pointer<T>{}, std::is_const<T>{});
}
But I want something like this:
template <typename T>
void f(T t, std::true_type) {}
template <typename T>
void f(T t)
{
f(t, std::and<std::is_pointer<T>, std::is_const<T>>{});
}
Does the Standard Library contain something like std::and
? If not, is there a simple way to implement it with the desired functionality?