首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::aligned_union

Defined in header <type_traits>

template< std::size_t Len, class... Types > struct aligned_union;

(since C++11)

提供成员类型胡枝子f。type,它是一种大小和对齐方式的POD类型,适合用作对Types.仓库的大小至少是Len...std::aligned_union还确定了最严格的%28max%29对齐要求。Types,并将其作为常量使用。alignment_value...

如果sizeof...(Types) == 0,该行为是未定义的。

成员类型

Name

Definition

type

the POD type suitable for storage of any type from Types

帮助者类型

template< std::size_t Len, class... Types > using aligned_union_t = typename aligned_union<Len,Types...>::type;

(since C++14)

成员常数

alignment_value static

the strictest alignment requirement of all Types (public static member constant)

可能的实施

#包括<algorithm>模板<std::size[医]泰伦,同学们..。类型>结构对齐[医]UNION{StaticConexprSTD::size[医]T对齐[医]值=std::最大值%28{对齐%28类型%29}%29;结构类型{对齐%28对齐[医]价值%%29焦耳[医]斯STD:最大值%28{Len,大小%28类型%29...}%29;};};

*。

另见

alignment_of (C++11)

obtains the type's alignment requirements (class template)

aligned_storage (C++11)

defines the type suitable for use as uninitialized storage for types of given size (class template)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券