NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
可转换性检查

检查类型之间的转换能力 更多...

可转换性检查 的协作图:

概念

concept  convertible_to
 检查类型From是否可以转换为类型To

struct  is_convertible< From, To >
 判断类型From是否可以隐式转换为类型To 更多...
struct  is_nothrow_convertible< From, To, IsConvertible, IsVoid >
 判断类型From是否可以无异常地转换为类型To 更多...
struct  is_nothrow_arrow< Iterator, Ptr, IsPtr >
 判断迭代器的箭头运算符是否不会抛出异常 更多...

类型定义

template<typename ToElement, typename FromElement>
using is_array_convertible = is_convertible<FromElement (*)[], ToElement (*)[]>
 判断数组元素类型FromElement是否可以转换为ToElement

变量

template<typename From, typename To>
NEFORCE_INLINE17 constexpr bool is_convertible_v = is_convertible<From, To>::value
 is_convertible的便捷变量模板
template<typename ToElement, typename FromElement>
NEFORCE_INLINE17 constexpr bool is_array_convertible_v = is_array_convertible<ToElement, FromElement>::value
 is_array_convertible的便捷变量模板
template<typename From, typename To>
NEFORCE_INLINE17 constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<From, To>::value
 is_nothrow_convertible的便捷变量模板
template<typename Iterator, typename Ptr>
NEFORCE_INLINE17 constexpr bool is_nothrow_arrow_v = is_nothrow_arrow<Iterator, Ptr>::value
 is_nothrow_arrow的便捷变量模板

详细描述

检查类型之间的转换能力

类型定义说明

◆ is_array_convertible

template<typename ToElement, typename FromElement>
using is_array_convertible = is_convertible<FromElement (*)[], ToElement (*)[]>

判断数组元素类型FromElement是否可以转换为ToElement

模板参数
ToElement目标元素类型
FromElement源元素类型

通过检查指向未知大小数组的指针的转换性来实现。

在文件 type_traits.hpp3163 行定义.