Namespaces
Variants

Standard library header <hive> (C++26)

From cppreference.net
Standard library headers

此头文件属于 容器 库的一部分。

目录

包含文件

(C++20)
三路比较运算符 支持
std::initializer_list 类模板

std::hive 中块容量限制的布局信息
(类)
(C++26)
可重用已擦除元素内存的集合
(类模板)

函数

特化 std::swap 算法
(函数模板)
擦除满足特定条件的所有元素
(函数模板)

概要

#include <compare>
#include <initializer_list>
namespace std {
  struct hive_limits
  {
    size_t min;
    size_t max;
    constexpr hive_limits(size_t minimum, size_t maximum) noexcept
    : min(minimum), max(maximum) {}
  };
  // 类模板 hive
  template<class T, class Allocator = allocator<T>>
  class hive;
  // swap 函数
  template<class T, class Allocator>
  void swap(hive<T, Allocator>& x, hive<T, Allocator>& y) noexcept(noexcept(x.swap(y)));
  template<class T, class Allocator, class U = T>
  typename hive<T, Allocator>::size_type erase(hive<T, Allocator>& c, const U& value);
  template<class T, class Allocator, class Predicate>
  typename hive<T, Allocator>::size_type erase_if(hive<T, Allocator>& c, Predicate pred);
  namespace pmr {
    template<class T>
    using hive = std::hive<T, polymorphic_allocator<T>>;
  }
}

类模板 std :: hive

namespace std {
  template<class T, class Allocator>
  class hive
  {
  public:
    // 类型定义:
    using value_type             = T;
    using allocator_type         = Allocator;
    using pointer                = allocator_traits<Allocator>::pointer;
    using const_pointer          = allocator_traits<Allocator>::const_pointer;
    using reference              = value_type&;
    using const_reference        = const value_type&;
    using size_type              = /* 实现定义 */;
    using difference_type        = /* 实现定义 */;
    using iterator               = /* 实现定义 */;
    using const_iterator         = /* 实现定义 */;
    using reverse_iterator       = std::reverse_iterator<iterator>;
    using const_reverse_iterator = std::reverse_iterator<const_iterator>;
    // 构造/复制/销毁
    constexpr hive() noexcept(noexcept(Allocator())) : hive(Allocator()) {}
    constexpr explicit hive(const Allocator&) noexcept;
    constexpr explicit hive(hive_limits block_limits) : hive(block_limits, Allocator()) {}
    constexpr hive(hive_limits block_limits, const Allocator&);
    explicit hive(size_type n, const Allocator& = Allocator());
    hive(size_type n, const T& value, const Allocator& = Allocator());
    hive(size_type n, const T& value, hive_limits block_limits, 
         const Allocator& = Allocator());
    template<class InputIter>
    hive(InputIter first, InputIter last, const Allocator& = Allocator());
    template<class InputIter>
    hive(InputIter first, InputIter last, hive_limits block_limits, 
         const Allocator& = Allocator());
    template<container-compatible-range<T> R>
    hive(from_range_t, R&& rg, const Allocator& = Allocator());
    template<container-compatible-range<T> R>
    hive(from_range_t, R&& rg, hive_limits block_limits, const Allocator& = Allocator());
    hive(const hive& other);
    hive(hive&& other) noexcept;
    hive(const hive& other, const type_identity_t<Allocator>& alloc);
    hive(hive&& other, const type_identity_t<Allocator>& alloc);
    hive(initializer_list<T> il, const Allocator& = Allocator());
    hive(initializer_list<T> il, hive_limits block_limits, const Allocator& = Allocator());
    ~hive();
    hive& operator=(const hive& other);
    hive& operator=(hive&& other) 
      noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value
            || allocator_traits<Allocator>::is_always_equal::value);
    hive& operator=(initializer_list<T>);
    template<class InputIter>
    void assign(InputIter first, InputIter last);
    template<container-compatible-range<T> R>
    void assign_range(R&& rg);
    void assign(size_type n, const T& value);
    void assign(initializer_list<T> il);
    allocator_type get_allocator() const noexcept;
    // 迭代器
    iterator begin() noexcept;
    const_iterator begin() const noexcept;
    iterator end() noexcept;
    const_iterator end() const noexcept;
    reverse_iterator rbegin() noexcept;
    const_reverse_iterator rbegin() const no