MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
类型属性操作

进行类型退化、公共化等操作 更多...

struct  decay< T >
 模拟函数参数传递中的类型退化 更多...
struct  common_type< Types >
 查找多个类型的公共类型 更多...
struct  is_specialization< T, Template >
 判断类型T是否为模板Template的特化 更多...

类型定义

template<typename T>
using decay_t = typename decay<T>::type
 decay的便捷别名
template<typename Default, template< typename... > class Op, typename... Args>
using detected_or = _INNER __detector<Default, void, Op, Args...>
 检测Op<Args...>是否有效,如果无效则使用Default类型
template<typename Default, template< typename... > class Op, typename... Args>
using detected_or_t = typename detected_or<Default, Op, Args...>::type
 detected_or的便捷别名,返回检测到的类型或默认类型
template<typename T1, typename T2>
using common_ternary_operator_t = decltype(true ? _MSTL declval<T1>() : _MSTL declval<T2>())
 三目运算符的公共类型推导
template<typename... Types>
using common_type_t = typename common_type<Types...>::type
 common_type的便捷别名

函数

template<typename T, template< typename... > class Template>
constexpr bool is_specialization_v ()
 is_specialization的便捷函数模板

详细描述

进行类型退化、公共化等操作

类型定义说明

◆ common_ternary_operator_t

template<typename T1, typename T2>
using common_ternary_operator_t = decltype(true ? _MSTL declval<T1>() : _MSTL declval<T2>())

三目运算符的公共类型推导

模板参数
T1第一个类型
T2第二个类型

三目运算符的类型推导规则:

  1. 如果T1和T2是相同类型,则整个表达式的类型是该类型
  2. 如果T1和T2是不同的类型,编译器会尝试找到一个公共类型
  3. 转换规则通常基于标准的隐式类型转换规则

在文件 type_traits.hpp3651 行定义.

◆ detected_or

template<typename Default, template< typename... > class Op, typename... Args>
using detected_or = _INNER __detector<Default, void, Op, Args...>

检测Op<Args...>是否有效,如果无效则使用Default类型

模板参数
Default默认类型
Op要检测的模板
Args模板参数

在文件 type_traits.hpp3629 行定义.

函数说明

◆ is_specialization_v()

template<typename T, template< typename... > class Template>
bool is_specialization_v ( )
constexpr

is_specialization的便捷函数模板

模板参数
T要检查的类型
Template要检查的模板
返回
如果T是Template的特化返回true,否则返回false

在文件 type_traits.hpp3853 行定义.

引用了 integral_constant< bool, Value >< false >::value.