Örneğintürünü std::is_pointer<T>
ve std::is_const<T>
ise kullanmak istiyorum.C++ type_traits standart yolundan koşulların nasıl birleştirileceği
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>{});
}
Ama hiç böyle bir şey istiyorum: Tabii
ve basit bir yöntemdir böyle olduğunu
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>>{});
}
c mi ++
std::and
gibi standart sınıflar şey? Eğer hayır, istenen işlevselliği ile uygulamak için basit bir yoldur?
std::integral_constant<bool,
std::is_pointer<T>::value && std::is_const<T>::value>
Yoksa genel bir özellik and
yazabilirsiniz: