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

请参见

参考

scoped_allocator_adaptor 类

allocator_traits::construct 方法