Na przykład chcę użyć typu T
tylko jeśli jest to std::is_pointer<T>
i std::is_const<T>
.C++ jak łączyć warunki z type_traits standard way
Oczywiście, istnieje prosty sposób tak:
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>{});
}
Ale chcę coś takiego:
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>>{});
}
jest w C++ standardowych klas coś jak std::and
? Jeśli nie, czy jest to prosty sposób na jego wdrożenie z pożądaną funkcjonalnością?