NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
内存就地操作函数

在指定内存位置构造对象 更多...

函数

template<typename T, typename... Args>
constexpr T * neforce::construct (T *ptr, Args &&... args) noexcept(is_nothrow_constructible_v< T, Args... >)
 在指定内存位置构造对象
template<typename T>
constexpr void neforce::destroy (T *pointer) noexcept(is_nothrow_destructible_v< T >)
 销毁单个对象
template<typename Iterator>
constexpr enable_if_t< is_iter_v< Iterator > &&!is_trivially_destructible_v< iter_value_t< Iterator > > > neforce::destroy (Iterator first, Iterator last) noexcept(is_nothrow_destructible_v< iter_value_t< Iterator > >)
 销毁迭代器范围内的对象序列

详细描述

在指定内存位置构造对象

函数说明

◆ construct()

template<typename T, typename... Args>
T * neforce::construct ( T * ptr,
Args &&... args )
constexprnoexcept

在指定内存位置构造对象

模板参数
T要构造的对象类型
Args构造参数类型
参数
ptr指向已分配内存的指针
args构造参数
返回
指向构造对象的void指针

使用定位new在指定内存位置构造对象,支持完美转发构造参数。 仅当T可以从Args...构造时才启用此重载。

在文件 construct.hpp33 行定义.

引用了 construct(), forward(), is_constructible_v , 以及 is_nothrow_constructible_v.

被这些函数引用 allocate_shared(), construct(), neforce::optional< T >::emplace(), neforce::optional< T >::emplace(), neforce::vector< Value, Alloc >::emplace(), neforce::deque< T, Alloc, BufSize >::emplace_back(), neforce::vector< Value, Alloc >::emplace_back(), neforce::deque< T, Alloc, BufSize >::emplace_front(), neforce::flat_hashtable< pair< Key, T >, Key, HashFcn, select1st< pair< Key, T > >, EqualKey, Alloc >::emplace_unique(), make_shared(), neforce::optional< T >::operator=(), neforce::optional< T >::operator=(), neforce::optional< T >::operator=(), neforce::optional< T >::operator=(), neforce::optional< T >::operator=(), neforce::optional< T >::operator=(), neforce::optional< T >::optional(), neforce::optional< T >::optional(), neforce::optional< T >::optional(), neforce::optional< T >::optional(), neforce::optional< T >::optional(), neforce::optional< T >::optional(), neforce::optional< T >::optional(), neforce::optional< T >::optional(), neforce::optional< T >::optional(), neforce::optional< T >::optional() , 以及 neforce::vector< Value, Alloc >::vector().

◆ destroy() [1/2]

template<typename Iterator>
enable_if_t< is_iter_v< Iterator > &&!is_trivially_destructible_v< iter_value_t< Iterator > > > neforce::destroy ( Iterator first,
Iterator last )
constexprnoexcept

销毁迭代器范围内的对象序列

模板参数
Iterator迭代器类型
参数
first范围的起始迭代器
last范围的结束迭代器

遍历迭代器范围,对每个元素调用析构函数。 仅当迭代器值类型非平凡可析构时才启用此重载。

在文件 construct.hpp61 行定义.

引用了 destroy() , 以及 is_nothrow_destructible_v.

◆ destroy() [2/2]

template<typename T>
void neforce::destroy ( T * pointer)
constexprnoexcept

销毁单个对象

模板参数
T对象类型
参数
pointer指向要销毁对象的指针

显式调用对象的析构函数,但不释放内存。

在文件 construct.hpp46 行定义.

引用了 destroy() , 以及 is_nothrow_destructible_v.

被这些函数引用 neforce::vector< Value, Alloc >::assign(), neforce::flat_hashtable< pair< Key, T >, Key, HashFcn, select1st< pair< Key, T > >, EqualKey, Alloc >::clear(), neforce::vector< Value, Alloc >::clear(), destroy(), destroy(), destroy(), neforce::vector< Value, Alloc >::emplace(), neforce::deque< T, Alloc, BufSize >::erase(), neforce::flat_hashtable< pair< Key, T >, Key, HashFcn, select1st< pair< Key, T > >, EqualKey, Alloc >::erase(), neforce::flat_hashtable< pair< Key, T >, Key, HashFcn, select1st< pair< Key, T > >, EqualKey, Alloc >::erase(), neforce::flat_hashtable< pair< Key, T >, Key, HashFcn, select1st< pair< Key, T > >, EqualKey, Alloc >::erase(), neforce::vector< Value, Alloc >::erase(), neforce::vector< Value, Alloc >::erase(), neforce::vector< Value, Alloc >::insert(), neforce::vector< Value, Alloc >::operator=(), neforce::deque< T, Alloc, BufSize >::pop_back(), neforce::vector< Value, Alloc >::pop_back(), neforce::vector< Value, Alloc >::pop_back_v(), neforce::deque< T, Alloc, BufSize >::pop_front(), neforce::vector< Value, Alloc >::reserve(), neforce::optional< T >::reset(), neforce::vector< Value, Alloc >::shrink_to_fit(), neforce::vector< Value, Alloc >::vector() , 以及 neforce::temporary_buffer< Iterator >::~temporary_buffer().