cppx-core
Namespaces | Variables
basic-type-traits.hpp File Reference

is_base_and_derived_, is_same_type_, is_a_, is_const_, is_class_, is_fixed_point_, is_floating_point_, is_integral_, is_integral_ and is_unsigned_. More...

#include <cppx-core/language/types/Truth.hpp>
#include <type_traits>
Include dependency graph for basic-type-traits.hpp:

Go to the source code of this file.

Namespaces

 cppx
 

Variables

template<class Base , class Derived >
constexpr Truth cppx::is_base_and_derived_ = std::is_base_of_v<Base, Derived>
 
template<class T , class U >
constexpr Truth cppx::is_same_type_ = std::is_same_v<T, U>
 
template<class T , class U >
constexpr Truth cppx::is_a_ = is_same_type_<T, U> or is_base_and_derived_<T, U>
 
template<class T >
constexpr Truth cppx::is_const_ = std::is_const_v<std::remove_reference_t<T>>
 
template<class T >
constexpr Truth cppx::is_class_ = std::is_class_v<T>
 
template<class T >
constexpr Truth cppx::is_fixed_point_ = false
 
template<class T >
constexpr Truth cppx::is_floating_point_ = std::is_floating_point_v<T>
 
template<class T >
constexpr Truth cppx::is_integral_ = std::is_integral_v<T>
 
template<class Int >
constexpr Truth cppx::is_signed_ = std::is_signed_v<Int>
 
template<class Int >
constexpr Truth cppx::is_unsigned_ = std::is_unsigned_v<Int>
 

Detailed Description

is_base_and_derived_, is_same_type_, is_a_, is_const_, is_class_, is_fixed_point_, is_floating_point_, is_integral_, is_integral_ and is_unsigned_.

is_based_and_derived_ clarifies the roles of the template arguments, which are not apparent in std::is_base_of_t. is_based_and_derived_ is also more clean regarded as English. is_const doesn't care if you feed it a reference, it then reports about the referent type. The numerical category type traits provide a common notation for checking also for fixed point type, which is an omission in the standard library. But in general it's all mainly about readability and convenience.

Definition in file basic-type-traits.hpp.