MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
aligned_buffer.hpp
浏览该文件的文档.
1#ifndef MSTL_CORE_MEMORY_ALIGNED_BUFFER_HPP__
2#define MSTL_CORE_MEMORY_ALIGNED_BUFFER_HPP__
3
11
14
20
28template <typename T>
29struct aligned_buffer : aligned_storage<sizeof(T), alignof(T)> {
35 aligned_storage_t<sizeof(T), alignof(T)> storage;
36
42 aligned_buffer() = default;
43
51
56 void* addr() noexcept { return static_cast<void*>(&storage); }
57
62 const void* addr() const noexcept { return static_cast<const void*>(&storage); }
63
70 T* ptr() noexcept { return static_cast<T*>(addr()); }
71
76 const T* ptr() const noexcept { return static_cast<const T*>(addr()); }
77};
78 // AlignedBuffer
80
82#endif // MSTL_CORE_MEMORY_ALIGNED_BUFFER_HPP__
typename aligned_storage< Len, Align >::type aligned_storage_t
aligned_storage的便捷别名
decltype(nullptr) nullptr_t
空指针类型
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
aligned_storage_t< sizeof(T), alignof(T)> storage
实际的存储缓冲区
const void * addr() const noexcept
获取缓冲区的原始常量地址
const T * ptr() const noexcept
获取缓冲区的类型化常量指针
void * addr() noexcept
获取缓冲区的原始地址
aligned_buffer(nullptr_t null)
nullptr_t构造函数
aligned_buffer()=default
默认构造函数
T * ptr() noexcept
获取缓冲区的类型化指针
创建指定大小和对齐要求的存储类型
MSTL类型萃取