cpp-toolbox  0.0.1
A toolbox library for C++
Loading...
Searching...
No Matches
toolbox::traits Namespace Reference

Namespaces

namespace  detail
 

Classes

class  enum_wrapper
 类型安全的枚举包装器/Type-safe enum wrapper More...
 
struct  function_traits
 函数特征基础模板/Function traits base template More...
 
struct  function_traits< R(Args...)>
 普通函数的函数特征/Function traits for regular functions More...
 
struct  function_traits< R(C::*)(Args...)>
 成员函数的函数特征/Function traits for member functions More...
 
struct  has_size
 检查类型是否有size成员/Check if type has size member More...
 
struct  has_size< T, std::void_t< decltype(std::declval< T >().size())> >
 
struct  has_toString
 检查类型是否有toString方法(C++17之前版本)/Check if type has toString method (pre-C++17 version) More...
 
struct  is_array
 检查类型是否为数组/Check if type is an array More...
 
struct  is_callable
 检查类型是否可调用/Check if type is callable More...
 
struct  is_callable< T, std::void_t< decltype(&T::operator())> >
 
struct  is_const
 检查类型是否为const限定/Check if type is const-qualified More...
 
struct  is_const_volatile
 检查类型是否同时具有const和volatile限定/Check if type is const-volatile qualified More...
 
struct  is_function
 检查类型是否为函数/Check if type is a function More...
 
struct  is_greater_than_comparable
 检查类型T和U是否支持大于运算符(>)/Check if types T and U support the greater-than operator (>) More...
 
struct  is_greater_than_comparable< T, U, std::void_t< decltype(std::declval< T >() > std::declval< U >())> >
 is_greater_than_comparable 的特化:当T和U支持>运算符时为true_type/Specialization of is_greater_than_comparable: true_type if T and U support > operator More...
 
struct  is_heap_allocated
 检查类型是否必须堆分配/Check if type must be heap allocated More...
 
struct  is_iterable
 
struct  is_iterable< T, void_t< decltype(std::begin(std::declval< T >())), decltype(std::end(std::declval< T >()))> >
 
struct  is_less_than_comparable
 检查类型T和U是否支持小于运算符(<)/Check if types T and U support the less-than operator (<) More...
 
struct  is_less_than_comparable< T, U, std::void_t< decltype(std::declval< T >()< std::declval< U >())> >
 is_less_than_comparable 的特化:当T和U支持<运算符时为true_type/Specialization of is_less_than_comparable: true_type if T and U support < operator More...
 
struct  is_member_pointer
 检查类型是否为成员指针/Check if type is a member pointer More...
 
struct  is_null_pointer
 检查类型是否为std::nullptr_t/Check if type is std::nullptr_t More...
 
struct  is_pointer
 检查类型是否为指针/Check if type is a pointer More...
 
struct  is_printable
 检查类型是否可打印/Check if type is printable More...
 
struct  is_reference
 检查类型是否为引用/Check if type is a reference More...
 
struct  is_stack_allocated
 检查类型是否可以栈分配/Check if type can be stack allocated More...
 
struct  is_volatile
 检查类型是否为volatile限定/Check if type is volatile-qualified More...
 
struct  remove_all_qualifiers
 移除类型的所有限定符/Remove all qualifiers from type More...
 
struct  remove_reference
 移除类型的引用/Remove reference from type More...
 
struct  type_identity
 类型标识特征/Type identity trait More...
 
struct  type_list
 类型列表容器/Type list container More...
 

Typedefs

template<typename... >
using void_t = void
 

Variables

template<typename T >
constexpr bool is_iterable_v = is_iterable<T>::value
 
template<typename T , typename U = T>
constexpr bool is_less_than_comparable_v
 is_less_than_comparable 的变量模板/Variable template for is_less_than_comparable
 
template<typename T , typename U = T>
constexpr bool is_greater_than_comparable_v
 is_greater_than_comparable 的变量模板/Variable template for is_greater_than_comparable
 

Typedef Documentation

◆ void_t

template<typename... >
using toolbox::traits::void_t = typedef void

Variable Documentation

◆ is_greater_than_comparable_v

template<typename T , typename U = T>
constexpr bool toolbox::traits::is_greater_than_comparable_v
inlineconstexpr
Initial value:
=
is_greater_than_comparable<T, U>::value

is_greater_than_comparable 的变量模板/Variable template for is_greater_than_comparable

Template Parameters
T第一个要比较的类型/First type to compare
U第二个要比较的类型/Second type to compare, defaults to T
if constexpr (toolbox::traits::is_greater_than_comparable_v<int, double>) {
// 可以安全使用 > 运算符/Can safely use > operator
}

◆ is_iterable_v

template<typename T >
constexpr bool toolbox::traits::is_iterable_v = is_iterable<T>::value
inlineconstexpr

◆ is_less_than_comparable_v

template<typename T , typename U = T>
constexpr bool toolbox::traits::is_less_than_comparable_v
inlineconstexpr
Initial value:
=
is_less_than_comparable<T, U>::value

is_less_than_comparable 的变量模板/Variable template for is_less_than_comparable

Template Parameters
T第一个要比较的类型/First type to compare
U第二个要比较的类型/Second type to compare, defaults to T
if constexpr (toolbox::traits::is_less_than_comparable_v<int, double>) {
// 可以安全使用 < 运算符/Can safely use < operator
}