scoped_allocator_adaptor::construct 方法
建構物件。
template<class Ty, class... Atypes>
void construct(Ty *ptr, Atypes&&... args);
template<class Ty1, class Ty2, class... Atypes1, class... Atypes2>
void construct(pair<Ty1, Ty2> *ptr, piecewise_construct_t,
tuple<Atypes1&&...> first, tuple<Atypes1&&...> second);
template<class Ty1, class Ty2>
void construct(pair<Ty1, Ty2> *ptr);
template<class Ty1, class Ty2, class Uy1, class Uy2>
void construct(pair<Ty1, Ty2> *ptr,
class Uy1&& first, class Uy2&& second);
template<class Ty1, class Ty2, class Uy1, class Uy2>
void construct(pair<Ty1, Ty2> *ptr, const pair<Uy1, Uy2>& right);
template<class Ty1, class Ty2, class Uy1, class Uy2>
void construct(pair<Ty1, Ty2> *ptr, pair<Uy1, Uy2>&& right);
參數
ptr
物件要建構的記憶體位置的指標。args
引數清單。first
物件的第一個輸入一個名稱/值組。second
第二個輸入一個名稱/值組。right
要移動或複製的現有物件。
備註
第一個方法來建構物件。 ptr 藉由呼叫 Outermost_traits::construct(OUTERMOST(*this), ptr, xargs...), xargs... 為下列其中一個。
如果 uses_allocator<Ty, inner_allocator_type> 中保留一個錯誤,則 xargs... 是 args...。
如果 uses_allocator<Ty, inner_allocator_type> 適用,如此一來, is_constructible<Ty, allocator_arg_t, inner_allocator_type, args...> 適用的話,則為 xargs...allocator_arg, inner_allocator(), args...。
如果 uses_allocator<Ty, inner_allocator_type> 適用,如此一來, is_constructible<Ty, args..., inner_allocator()> 適用的話,則為 xargs...args..., inner_allocator()。
第二個方法會建構會對 ptr 藉由呼叫 Outermost_traits::construct(OUTERMOST(*this), &ptr->first, xargs...), xargs... 是在上述清單中修改的 first... 和 Outermost_traits::construct(OUTERMOST(*this), &ptr->second, xargs...), xargs... 是在上述清單中的 second... 修改。
第三個方法的運作方式和 this->construct(ptr, piecewise_construct, tuple<>, tuple<>)相同。
第四個方法正常運作方式和 this->construct(ptr, piecewise_construct, forward_as_tuple(std::forward<Uy1>(first), forward_as_tuple(std::forward<Uy2>(second))相同。
第五個方法正常運作方式和 this->construct(ptr, piecewise_construct, forward_as_tuple(right.first), forward_as_tuple(right.second))相同。
第六個方法正常運作方式和 this->construct(ptr, piecewise_construct, forward_as_tuple(std::forward<Uy1>(right.first), forward_as_tuple(std::forward<Uy2>(right.second))相同。
需求
標題: <scoped_allocator>
命名空間: std