MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
aligned_union< Len, Types > 模板结构体 参考

创建可以容纳多种类型的对齐存储类型 更多...

#include <type_traits.hpp>

struct  type
 实际的对齐存储类型 更多...

静态 Public 成员函数

template<typename T>
static constexpr bool is_storable () noexcept
 检查指定类型是否可以安全存储在aligned_union中

静态 Public 属性

static constexpr size_t alignment_value = required_alignment
 存储的对齐要求
static constexpr size_t size_value = storage_size
 存储的实际大小

详细描述

template<size_t Len, typename... Types>
struct aligned_union< Len, Types >

创建可以容纳多种类型的对齐存储类型

模板参数
Len最小存储大小
Types可能的类型列表

创建一个可以容纳Types中任何类型的存储,具有严格的对齐要求。

在文件 type_traits.hpp3510 行定义.

成员函数说明

◆ is_storable()

template<size_t Len, typename... Types>
template<typename T>
constexpr bool aligned_union< Len, Types >::is_storable ( )
inlinestaticconstexprnoexcept

检查指定类型是否可以安全存储在aligned_union中

模板参数
T要检查的类型
返回
true 如果类型T可以安全存储,false 否则

类型T必须满足以下条件:

  1. 是平凡可复制的(trivially copyable)
  2. 大小不超过存储大小
  3. 对齐要求不超过存储对齐

在文件 type_traits.hpp3547 行定义.

引用了 alignment_value , 以及 integral_constant< bool, Value >::value.


该结构体的文档由以下文件生成: