1#ifndef MSTL_CORE_MEMORY_TEMPORARY_BUFFER_HPP__
2#define MSTL_CORE_MEMORY_TEMPORARY_BUFFER_HPP__
31template <
typename Iterator>
58 MSTL_CONSTEXPR20
void allocate_buffer() {
80 template <
typename U = value_type, enable_if_t<is_trivially_copy_assignable_v<U>,
int> = 0>
81 MSTL_ALWAYS_INLINE MSTL_CONSTEXPR20
void initialize_buffer(
const U& val)
noexcept {}
91 template <
typename U = value_type, enable_if_t<!is_trivially_copy_assignable_v<U>,
int> = 0>
92 MSTL_ALWAYS_INLINE MSTL_CONSTEXPR20
void initialize_buffer(
const U& val) {
114 this->allocate_buffer();
115 if (len_ > 0) this->initialize_buffer(*first);
147 return original_len_;
163 return buffer_ + len_;
179 return buffer_ + len_;
186 MSTL_NODISCARD MSTL_CONSTEXPR20
bool empty() const noexcept {
static MSTL_NODISCARD constexpr T max() noexcept
获取类型的最大值
MSTL_ALLOC_NODISCARD MSTL_CONSTEXPR20 static MSTL_ALLOC_OPTIMIZE pointer allocate()
static MSTL_CONSTEXPR20 void deallocate(pointer p, const size_type n) noexcept
constexpr const T & max(const T &a, const T &b, Compare comp) noexcept(noexcept(comp(a, b)))
返回两个值中的较大者
MSTL_CONSTEXPR20 void destroy(T *pointer) noexcept(is_nothrow_destructible_v< T >)
销毁单个对象
MSTL_INLINE17 constexpr bool is_ranges_fwd_iter_v
检查是否为范围前向迭代器
constexpr iter_difference_t< Iterator > distance(Iterator first, Iterator last)
计算两个迭代器之间的距离
typename iterator_traits< Iterator >::value_type iter_value_t
获取迭代器的值类型
#define _MSTL
全局命名空间MSTL前缀
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
MSTL_CONSTEXPR20 Iterator uninitialized_fill_n(Iterator first, size_t n, const T &x)
在未初始化内存中用指定值填充指定数量的元素
standard_allocator< value_type > allocator_type
分配器类型
MSTL_NODISCARD MSTL_CONSTEXPR20 size_type size() const noexcept
获取缓冲区实际大小
temporary_buffer(const temporary_buffer &)=delete
禁止复制构造
ptrdiff_t difference_type
差异类型
MSTL_NODISCARD MSTL_CONSTEXPR20 const_pointer cend() const noexcept
获取常量缓冲区结束迭代器
void operator=(const temporary_buffer &)=delete
禁止复制赋值
const value_type & const_reference
常量引用类型
value_type & reference
引用类型
MSTL_NODISCARD MSTL_CONSTEXPR20 pointer end() noexcept
获取缓冲区结束迭代器
MSTL_CONSTEXPR20 ~temporary_buffer()
析构函数
MSTL_NODISCARD MSTL_CONSTEXPR20 size_type requested_size() const noexcept
获取请求的缓冲区大小
MSTL_NODISCARD MSTL_CONSTEXPR20 const_pointer cbegin() const noexcept
获取常量缓冲区起始迭代器
MSTL_NODISCARD MSTL_CONSTEXPR20 pointer begin() noexcept
获取缓冲区起始迭代器
MSTL_NODISCARD MSTL_CONSTEXPR20 bool empty() const noexcept
检查缓冲区是否为空
iter_value_t< Iterator > value_type
元素类型
MSTL_CONSTEXPR20 temporary_buffer(Iterator first, Iterator last)
构造函数
const value_type * const_pointer
常量指针类型