29 #ifndef _ALIGNED_BUFFER_H
30 #define _ALIGNED_BUFFER_H 1
32 #pragma GCC system_header
34 #if __cplusplus >= 201103L
46 template<
typename _Tp>
47 struct __aligned_membuf
52 struct _Tp2 { _Tp _M_t; };
54 alignas(__alignof__(_Tp2::_M_t))
unsigned char _M_storage[
sizeof(_Tp)];
56 __aligned_membuf() =
default;
59 __aligned_membuf(std::nullptr_t) { }
63 {
return static_cast<void*
>(&_M_storage); }
67 {
return static_cast<const void*
>(&_M_storage); }
71 {
return static_cast<_Tp*
>(_M_addr()); }
75 {
return static_cast<const _Tp*
>(_M_addr()); }
78 #if _GLIBCXX_INLINE_VERSION
79 template<
typename _Tp>
80 using __aligned_buffer = __aligned_membuf<_Tp>;
87 template<
typename _Tp>
88 struct __aligned_buffer
95 __aligned_buffer() =
default;
98 __aligned_buffer(std::nullptr_t) { }
103 return static_cast<void*
>(&_M_storage);
109 return static_cast<const void*
>(&_M_storage);
114 {
return static_cast<_Tp*
>(_M_addr()); }
118 {
return static_cast<const _Tp*
>(_M_addr()); }
enable_if< ::__array_traits< _Tp, _Nm >::_Is_swappable::value >::type noexcept(noexcept(__one.swap(__two)))
swap