标准库头文件 <scoped_allocator>

来自cppreference.com
< cpp‎ | header
 
 
 

此头文件是动态内存管理库的一部分。

为多级容器实现的多级分配器
(类模板)

函数

比较两个 scoped_allocator_adaptor 实例
(std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...> 的公开成员函数)

概要

namespace std {
 
    template <class OuterAlloc, class... InnerAlloc>
    class scoped_allocator_adaptor;
 
    template <class OuterA1, class OuterA2, class... InnerAllocs>
    bool operator==(const scoped_allocator_adaptor<OuterA1,
                                                   InnerAllocs...>& a,
                    const scoped_allocator_adaptor<OuterA2,
                                                   InnerAllocs...>& b) noexcept;
    template <class OuterA1, class OuterA2, class... InnerAllocs>
    bool operator!=(const scoped_allocator_adaptor<OuterA1,
                                                   InnerAllocs...>& a,
                    const scoped_allocator_adaptor<OuterA2,
                                                   InnerAllocs...>& b) noexcept;
}

类模板 std::scoped_allocator_adaptor

namespace std {
  template <class OuterAlloc, class... InnerAllocs>
  class scoped_allocator_adaptor : public OuterAlloc {
  private:
    using OuterTraits = allocator_traits<OuterAlloc>; // 仅用于阐释
    scoped_allocator_adaptor<InnerAllocs...> inner; // 仅用于阐释
  public:
    using outer_allocator_type = OuterAlloc;
    using inner_allocator_type = /* 见定义 */ ;
    using value_type = typename OuterTraits::value_type;
    using size_type = typename OuterTraits::size_type;
    using difference_type = typename OuterTraits::difference_type;
    using pointer = typename OuterTraits::pointer;
    using const_pointer = typename OuterTraits::const_pointer;
    using void_pointer = typename OuterTraits::void_pointer;
    using const_void_pointer = typename OuterTraits::const_void_pointer;
    using propagate_on_container_copy_assignment = /* 见定义 */ ;
    using propagate_on_container_move_assignment = /* 见定义 */ ;
    using propagate_on_container_swap = /* 见定义 */ ;
    using is_always_equal = /* 见定义 */ ;
    template <class Tp>
    struct rebind {
      using other = scoped_allocator_adaptor<
                      OuterTraits::template rebind_alloc<Tp>,
                      InnerAllocs...>;
    };
    scoped_allocator_adaptor();
    template <class OuterA2>
    scoped_allocator_adaptor(OuterA2&& outerAlloc,
                             const InnerAllocs&... innerAllocs) noexcept;
    scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
    scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
    template <class OuterA2>
    scoped_allocator_adaptor(const scoped_allocator_adaptor<
                                     OuterA2,
                                     InnerAllocs...>& other) noexcept;
    template <class OuterA2>
    scoped_allocator_adaptor(scoped_allocator_adaptor<
                               OuterA2,
                               InnerAllocs...>&& other) noexcept;
    scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
    scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
    ~scoped_allocator_adaptor();
    inner_allocator_type& inner_allocator() noexcept;
    const inner_allocator_type& inner_allocator() const noexcept;
    outer_allocator_type& outer_allocator() noexcept;
    const outer_allocator_type& outer_allocator() const noexcept;
    pointer allocate(size_type n);
    pointer allocate(size_type n, const_void_pointer hint);
    void deallocate(pointer p, size_type n);
    size_type max_size() const;
    template <class T, class... Args>
    void construct(T* p, Args&&... args);
    template <class T1, class T2, class... Args1, class... Args2>
    void construct(pair<T1, T2>* p, piecewise_construct_t,
                   tuple<Args1...> x, tuple<Args2...> y);
    template <class T1, class T2>
    void construct(pair<T1, T2>* p);
    template <class T1, class T2, class U, class V>
    void construct(pair<T1, T2>* p, U&& x, V&& y);
    template <class T1, class T2, class U, class V>
    void construct(pair<T1, T2>* p, const pair<U, V>& x);
    template <class T1, class T2, class U, class V>
    void construct(pair<T1, T2>* p, pair<U, V>&& x);
    template <class T>
    void destroy(T* p);
    scoped_allocator_adaptor select_on_container_copy_construction() const;
  };
}