Namespaces
Variants
Views
Actions

Difference between revisions of "Template:cpp/synopsis/vector"

From cppreference.com
m (Synopsis update as per P2248R8.)
m (+`std::formatter` specialization for `vector<bool>`)
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
namespace std {
 
namespace std {
 
   // class template vector
 
   // class template vector
   template<class T, class Allocator = allocator<T>> class vector;
+
   template<class T, class Allocator = allocator<T>>
 +
  class vector;
  
 
   template<class T, class Allocator>
 
   template<class T, class Allocator>
    constexpr bool operator==(const vector<T, Allocator>& x,
+
  constexpr bool operator==(const vector<T, Allocator>& x, const vector<T, Allocator>& y);
                              const vector<T, Allocator>& y);
+
 
   template<class T, class Allocator>
 
   template<class T, class Allocator>
    constexpr __synth_three_way_result<T> operator<=>(const vector<T, Allocator>& x,
+
  constexpr /*synth-three-way-result*/<T> operator<=>(const vector<T, Allocator>& x,
                                                    const vector<T, Allocator>& y);
+
                                                      const vector<T, Allocator>& y);
  
 
   template<class T, class Allocator>
 
   template<class T, class Allocator>
    constexpr void swap(vector<T, Allocator>& x, vector<T, Allocator>& y)
+
  constexpr void swap(vector<T, Allocator>& x,
      noexcept(noexcept(x.swap(y)));
+
                      vector<T, Allocator>& y) noexcept(noexcept(x.swap(y)));
  
 
   // erasure
 
   // erasure
 
   template<class T, class Allocator, class U = T>
 
   template<class T, class Allocator, class U = T>
    constexpr typename vector<T, Allocator>::size_type
+
  constexpr typename vector<T, Allocator>::size_type erase(vector<T, Allocator>& c,
      erase(vector<T, Allocator>& c, const U& value);
+
                                                          const U& value);
 
   template<class T, class Allocator, class Predicate>
 
   template<class T, class Allocator, class Predicate>
    constexpr typename vector<T, Allocator>::size_type
+
  constexpr typename vector<T, Allocator>::size_type erase_if(vector<T, Allocator>& c,
      erase_if(vector<T, Allocator>& c, Predicate pred);
+
                                                              Predicate pred);
  
 
   namespace pmr {
 
   namespace pmr {
 
     template<class T>
 
     template<class T>
      using vector = std::vector<T, polymorphic_allocator<T>>;
+
    using vector = std::vector<T, polymorphic_allocator<T>>;
 
   }
 
   }
  
Line 34: Line 34:
 
   // partial class template specialization vector<bool, Allocator>
 
   // partial class template specialization vector<bool, Allocator>
 
   template<class Allocator>
 
   template<class Allocator>
    class vector<bool, Allocator>;
+
  class vector<bool, Allocator>;
  
 
   template<class T>
 
   template<class T>
    constexpr bool __is_vector_bool_reference = /* see description */; // exposition only
+
  constexpr bool /*is-vector-bool-reference*/ = /* see description */; // exposition only
  
 
   // hash support
 
   // hash support
   template<class T> struct hash;
+
   template<class T>
   template<class Allocator> struct hash<vector<bool, Allocator>>;
+
  struct hash;
 +
   template<class Allocator>
 +
  struct hash<vector<bool, Allocator>>;
  
 
   // formatter specialization for vector<bool>
 
   // formatter specialization for vector<bool>
   template<class T, class CharT> requires __is_vector_bool_reference<T>
+
   template<class T, class CharT>
    struct formatter<T, CharT>;
+
    requires /*is-vector-bool-reference*/<T>
 +
  struct formatter<T, CharT>;
 
}
 
}
 
}}
 
}}
Line 53: Line 56:
 
namespace std {
 
namespace std {
 
   template<class T, class Allocator = allocator<T>>
 
   template<class T, class Allocator = allocator<T>>
   class vector {
+
   class vector
 +
  {
 
   public:
 
   public:
 
     // types
 
     // types
Line 70: Line 74:
  
 
     // construct/copy/destroy
 
     // construct/copy/destroy
     constexpr vector() noexcept(noexcept(Allocator())) : vector(Allocator()) { }
+
     constexpr vector() noexcept(noexcept(Allocator()))
 +
      : vector(Allocator())
 +
    {
 +
    }
 
     constexpr explicit vector(const Allocator&) noexcept;
 
     constexpr explicit vector(const Allocator&) noexcept;
 
     constexpr explicit vector(size_type n, const Allocator& = Allocator());
 
     constexpr explicit vector(size_type n, const Allocator& = Allocator());
 
     constexpr vector(size_type n, const T& value, const Allocator& = Allocator());
 
     constexpr vector(size_type n, const T& value, const Allocator& = Allocator());
     template<class InputIt>
+
     template<class InputIter>
      constexpr vector(InputIt first, InputIt last, const Allocator& = Allocator());
+
    constexpr vector(InputIter first, InputIter last, const Allocator& = Allocator());
 
     template<container-compatible-range<T> R>
 
     template<container-compatible-range<T> R>
      constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
+
    constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
 
     constexpr vector(const vector& x);
 
     constexpr vector(const vector& x);
 
     constexpr vector(vector&&) noexcept;
 
     constexpr vector(vector&&) noexcept;
Line 85: Line 92:
 
     constexpr ~vector();
 
     constexpr ~vector();
 
     constexpr vector& operator=(const vector& x);
 
     constexpr vector& operator=(const vector& x);
     constexpr vector& operator=(vector&& x)
+
     constexpr vector& operator=(vector&& x) noexcept(
      noexcept(
+
      allocator_traits<Allocator>::propagate_on_container_move_assignment::value {{!!}}
        allocator_traits<Allocator>::propagate_on_container_move_assignment::value {{!!}}
+
      allocator_traits<Allocator>::is_always_equal::value);
        allocator_traits<Allocator>::is_always_equal::value
+
      );
+
 
     constexpr vector& operator=(initializer_list<T>);
 
     constexpr vector& operator=(initializer_list<T>);
     template<class InputIt>
+
     template<class InputIter>
      constexpr void assign(InputIt first, InputIt last);
+
    constexpr void assign(InputIter first, InputIter last);
 
     template<container-compatible-range<T> R>
 
     template<container-compatible-range<T> R>
      constexpr void assign_range(R&& rg);
+
    constexpr void assign_range(R&& rg);
 
     constexpr void assign(size_type n, const T& u);
 
     constexpr void assign(size_type n, const T& u);
 
     constexpr void assign(initializer_list<T>);
 
     constexpr void assign(initializer_list<T>);
Line 100: Line 105:
  
 
     // iterators
 
     // iterators
     constexpr iterator               begin() noexcept;
+
     constexpr iterator begin() noexcept;
     constexpr const_iterator         begin() const noexcept;
+
     constexpr const_iterator begin() const noexcept;
     constexpr iterator               end() noexcept;
+
     constexpr iterator end() noexcept;
     constexpr const_iterator         end() const noexcept;
+
     constexpr const_iterator end() const noexcept;
     constexpr reverse_iterator       rbegin() noexcept;
+
     constexpr reverse_iterator rbegin() noexcept;
 
     constexpr const_reverse_iterator rbegin() const noexcept;
 
     constexpr const_reverse_iterator rbegin() const noexcept;
     constexpr reverse_iterator       rend() noexcept;
+
     constexpr reverse_iterator rend() noexcept;
 
     constexpr const_reverse_iterator rend() const noexcept;
 
     constexpr const_reverse_iterator rend() const noexcept;
  
     constexpr const_iterator         cbegin() const noexcept;
+
     constexpr const_iterator cbegin() const noexcept;
     constexpr const_iterator         cend() const noexcept;
+
     constexpr const_iterator cend() const noexcept;
 
     constexpr const_reverse_iterator crbegin() const noexcept;
 
     constexpr const_reverse_iterator crbegin() const noexcept;
 
     constexpr const_reverse_iterator crend() const noexcept;
 
     constexpr const_reverse_iterator crend() const noexcept;
  
 
     // capacity
 
     // capacity
     [[nodiscard]] constexpr bool empty() const noexcept;
+
     constexpr bool empty() const noexcept;
 
     constexpr size_type size() const noexcept;
 
     constexpr size_type size() const noexcept;
 
     constexpr size_type max_size() const noexcept;
 
     constexpr size_type max_size() const noexcept;
 
     constexpr size_type capacity() const noexcept;
 
     constexpr size_type capacity() const noexcept;
     constexpr void     resize(size_type sz);
+
     constexpr void resize(size_type sz);
     constexpr void     resize(size_type sz, const T& c);
+
     constexpr void resize(size_type sz, const T& c);
     constexpr void     reserve(size_type n);
+
     constexpr void reserve(size_type n);
     constexpr void     shrink_to_fit();
+
     constexpr void shrink_to_fit();
  
 
     // element access
 
     // element access
     constexpr reference       operator[](size_type n);
+
     constexpr reference operator[](size_type n);
 
     constexpr const_reference operator[](size_type n) const;
 
     constexpr const_reference operator[](size_type n) const;
 
     constexpr const_reference at(size_type n) const;
 
     constexpr const_reference at(size_type n) const;
     constexpr reference       at(size_type n);
+
     constexpr reference at(size_type n);
     constexpr reference       front();
+
     constexpr reference front();
 
     constexpr const_reference front() const;
 
     constexpr const_reference front() const;
     constexpr reference       back();
+
     constexpr reference back();
 
     constexpr const_reference back() const;
 
     constexpr const_reference back() const;
  
 
     // data access
 
     // data access
     constexpr T*       data() noexcept;
+
     constexpr T* data() noexcept;
 
     constexpr const T* data() const noexcept;
 
     constexpr const T* data() const noexcept;
  
 
     // modifiers
 
     // modifiers
     template<class... Args> constexpr reference emplace_back(Args&&... args);
+
     template<class... Args>
 +
    constexpr reference emplace_back(Args&&... args);
 
     constexpr void push_back(const T& x);
 
     constexpr void push_back(const T& x);
 
     constexpr void push_back(T&& x);
 
     constexpr void push_back(T&& x);
 
     template<container-compatible-range<T> R>
 
     template<container-compatible-range<T> R>
      constexpr void append_range(R&& rg);
+
    constexpr void append_range(R&& rg);
 
     constexpr void pop_back();
 
     constexpr void pop_back();
  
     template<class... Args> constexpr iterator emplace(const_iterator position,
+
     template<class... Args>
                                                      Args&&... args);
+
    constexpr iterator emplace(const_iterator position, Args&&... args);
 
     constexpr iterator insert(const_iterator position, const T& x);
 
     constexpr iterator insert(const_iterator position, const T& x);
 
     constexpr iterator insert(const_iterator position, T&& x);
 
     constexpr iterator insert(const_iterator position, T&& x);
 
     constexpr iterator insert(const_iterator position, size_type n, const T& x);
 
     constexpr iterator insert(const_iterator position, size_type n, const T& x);
     template<class InputIt>
+
     template<class InputIter>
      constexpr iterator insert(const_iterator position,
+
    constexpr iterator insert(const_iterator position, InputIter first, InputIter last);
                                InputIt first, InputIt last);
+
 
     template<container-compatible-range<T> R>
 
     template<container-compatible-range<T> R>
      constexpr iterator insert_range(const_iterator position, R&& rg);
+
    constexpr iterator insert_range(const_iterator position, R&& rg);
 
     constexpr iterator insert(const_iterator position, initializer_list<T> il);
 
     constexpr iterator insert(const_iterator position, initializer_list<T> il);
 
     constexpr iterator erase(const_iterator position);
 
     constexpr iterator erase(const_iterator position);
 
     constexpr iterator erase(const_iterator first, const_iterator last);
 
     constexpr iterator erase(const_iterator first, const_iterator last);
     constexpr void     swap(vector&)
+
     constexpr void swap(vector&) noexcept(
       noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value {{!!}}
+
       allocator_traits<Allocator>::propagate_on_container_swap::value {{!!}}
              allocator_traits<Allocator>::is_always_equal::value);
+
      allocator_traits<Allocator>::is_always_equal::value);
     constexpr void     clear() noexcept;
+
     constexpr void clear() noexcept;
 
   };
 
   };
  
   template<class InputIt, class Allocator = allocator<__iter_value_type<InputIt>>>
+
   template<class InputIter, class Allocator = allocator</*iter-value-type*/<InputIter>>>
    vector(InputIt, InputIt, Allocator = Allocator())
+
  vector(InputIter, InputIter, Allocator = Allocator())
      -> vector<__iter_value_type<InputIt>, Allocator>;
+
    -> vector</*iter-value-type*/<InputIter>, Allocator>;
  
 
   template<ranges::input_range R, class Allocator = allocator<ranges::range_value_t<R>>>
 
   template<ranges::input_range R, class Allocator = allocator<ranges::range_value_t<R>>>
    vector(from_range_t, R&&, Allocator = Allocator())
+
  vector(from_range_t, R&&, Allocator = Allocator())
      -> vector<ranges::range_value_t<R>, Allocator>;
+
    -> vector<ranges::range_value_t<R>, Allocator>;
 
}
 
}
 
}}
 
}}
  
====Class template {{lc|std::vector}}'s specialization for {{c|bool}}====
+
====Class template {{lc|std::vector}} specialization for {{c/core|bool}}====
 
{{source|1=
 
{{source|1=
 
namespace std {
 
namespace std {
 
   template<class Allocator>
 
   template<class Allocator>
   class vector<bool, Allocator> {
+
   class vector<bool, Allocator>
 +
  {
 
   public:
 
   public:
 
     // types
 
     // types
Line 195: Line 201:
  
 
     // bit reference
 
     // bit reference
     class reference {
+
     class reference
      friend class vector;
+
    {
 
       constexpr reference() noexcept;
 
       constexpr reference() noexcept;
  
Line 206: Line 212:
 
       constexpr reference& operator=(const reference& x) noexcept;
 
       constexpr reference& operator=(const reference& x) noexcept;
 
       constexpr const reference& operator=(bool x) const noexcept;
 
       constexpr const reference& operator=(bool x) const noexcept;
       constexpr void flip() noexcept;   // flips the bit
+
       constexpr void flip() noexcept; // flips the bit
 
     };
 
     };
  
 
     // construct/copy/destroy
 
     // construct/copy/destroy
     constexpr vector() noexcept(noexcept(Allocator())) : vector(Allocator()) { }
+
     constexpr vector() noexcept(noexcept(Allocator()))
 +
      : vector(Allocator())
 +
    {
 +
    }
 
     constexpr explicit vector(const Allocator&) noexcept;
 
     constexpr explicit vector(const Allocator&) noexcept;
 
     constexpr explicit vector(size_type n, const Allocator& = Allocator());
 
     constexpr explicit vector(size_type n, const Allocator& = Allocator());
 
     constexpr vector(size_type n, const bool& value, const Allocator& = Allocator());
 
     constexpr vector(size_type n, const bool& value, const Allocator& = Allocator());
     template<class InputIt>
+
     template<class InputIter>
      constexpr vector(InputIt first, InputIt last, const Allocator& = Allocator());
+
    constexpr vector(InputIter first, InputIter last, const Allocator& = Allocator());
 
     template<container-compatible-range<bool> R>
 
     template<container-compatible-range<bool> R>
      constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
+
    constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
 
     constexpr vector(const vector& x);
 
     constexpr vector(const vector& x);
 
     constexpr vector(vector&& x) noexcept;
 
     constexpr vector(vector&& x) noexcept;
Line 225: Line 234:
 
     constexpr ~vector();
 
     constexpr ~vector();
 
     constexpr vector& operator=(const vector& x);
 
     constexpr vector& operator=(const vector& x);
     constexpr vector& operator=(vector&& x)
+
     constexpr vector& operator=(vector&& x) noexcept(
      noexcept(
+
      allocator_traits<Allocator>::propagate_on_container_move_assignment::value {{!!}}
        allocator_traits<Allocator>::propagate_on_container_move_assignment::value {{!!}}
+
      allocator_traits<Allocator>::is_always_equal::value);
        allocator_traits<Allocator>::is_always_equal::value
+
      );
+
 
     constexpr vector& operator=(initializer_list<bool>);
 
     constexpr vector& operator=(initializer_list<bool>);
     template<class InputIt>
+
     template<class InputIter>
      constexpr void assign(InputIt first, InputIt last);
+
    constexpr void assign(InputIter first, InputIter last);
 
     template<container-compatible-range<bool> R>
 
     template<container-compatible-range<bool> R>
      constexpr void assign_range(R&& rg);
+
    constexpr void assign_range(R&& rg);
 
     constexpr void assign(size_type n, const bool& t);
 
     constexpr void assign(size_type n, const bool& t);
 
     constexpr void assign(initializer_list<bool>);
 
     constexpr void assign(initializer_list<bool>);
Line 240: Line 247:
  
 
     // iterators
 
     // iterators
     constexpr iterator               begin() noexcept;
+
     constexpr iterator begin() noexcept;
     constexpr const_iterator         begin() const noexcept;
+
     constexpr const_iterator begin() const noexcept;
     constexpr iterator               end() noexcept;
+
     constexpr iterator end() noexcept;
     constexpr const_iterator         end() const noexcept;
+
     constexpr const_iterator end() const noexcept;
     constexpr reverse_iterator       rbegin() noexcept;
+
     constexpr reverse_iterator rbegin() noexcept;
 
     constexpr const_reverse_iterator rbegin() const noexcept;
 
     constexpr const_reverse_iterator rbegin() const noexcept;
     constexpr reverse_iterator       rend() noexcept;
+
     constexpr reverse_iterator rend() noexcept;
 
     constexpr const_reverse_iterator rend() const noexcept;
 
     constexpr const_reverse_iterator rend() const noexcept;
  
     constexpr const_iterator         cbegin() const noexcept;
+
     constexpr const_iterator cbegin() const noexcept;
     constexpr const_iterator         cend() const noexcept;
+
     constexpr const_iterator cend() const noexcept;
 
     constexpr const_reverse_iterator crbegin() const noexcept;
 
     constexpr const_reverse_iterator crbegin() const noexcept;
 
     constexpr const_reverse_iterator crend() const noexcept;
 
     constexpr const_reverse_iterator crend() const noexcept;
  
 
     // capacity
 
     // capacity
     [[nodiscard]] constexpr bool empty() const noexcept;
+
     constexpr bool empty() const noexcept;
 
     constexpr size_type size() const noexcept;
 
     constexpr size_type size() const noexcept;
 
     constexpr size_type max_size() const noexcept;
 
     constexpr size_type max_size() const noexcept;
 
     constexpr size_type capacity() const noexcept;
 
     constexpr size_type capacity() const noexcept;
     constexpr void     resize(size_type sz, bool c = false);
+
     constexpr void resize(size_type sz, bool c = false);
     constexpr void     reserve(size_type n);
+
     constexpr void reserve(size_type n);
     constexpr void     shrink_to_fit();
+
     constexpr void shrink_to_fit();
  
 
     // element access
 
     // element access
     constexpr reference       operator[](size_type n);
+
     constexpr reference operator[](size_type n);
 
     constexpr const_reference operator[](size_type n) const;
 
     constexpr const_reference operator[](size_type n) const;
 
     constexpr const_reference at(size_type n) const;
 
     constexpr const_reference at(size_type n) const;
     constexpr reference       at(size_type n);
+
     constexpr reference at(size_type n);
     constexpr reference       front();
+
     constexpr reference front();
 
     constexpr const_reference front() const;
 
     constexpr const_reference front() const;
     constexpr reference       back();
+
     constexpr reference back();
 
     constexpr const_reference back() const;
 
     constexpr const_reference back() const;
  
 
     // modifiers
 
     // modifiers
     template<class... Args> constexpr reference emplace_back(Args&&... args);
+
     template<class... Args>
 +
    constexpr reference emplace_back(Args&&... args);
 
     constexpr void push_back(const bool& x);
 
     constexpr void push_back(const bool& x);
 
     template<container-compatible-range<bool> R>
 
     template<container-compatible-range<bool> R>
      constexpr void append_range(R&& rg);
+
    constexpr void append_range(R&& rg);
 
     constexpr void pop_back();
 
     constexpr void pop_back();
     template<class... Args> constexpr iterator emplace(const_iterator position,
+
     template<class... Args>
                                                      Args&&... args);
+
    constexpr iterator emplace(const_iterator position, Args&&... args);
 
     constexpr iterator insert(const_iterator position, const bool& x);
 
     constexpr iterator insert(const_iterator position, const bool& x);
 
     constexpr iterator insert(const_iterator position, size_type n, const bool& x);
 
     constexpr iterator insert(const_iterator position, size_type n, const bool& x);
     template<class InputIt>
+
     template<class InputIter>
      constexpr iterator insert(const_iterator position,
+
    constexpr iterator insert(const_iterator position, InputIter first, InputIter last);
                                InputIt first, InputIt last);
+
 
     template<container-compatible-range<bool> R>
 
     template<container-compatible-range<bool> R>
      constexpr iterator insert_range(const_iterator position, R&& rg);
+
    constexpr iterator insert_range(const_iterator position, R&& rg);
 
     constexpr iterator insert(const_iterator position, initializer_list<bool> il);
 
     constexpr iterator insert(const_iterator position, initializer_list<bool> il);
  
 
     constexpr iterator erase(const_iterator position);
 
     constexpr iterator erase(const_iterator position);
 
     constexpr iterator erase(const_iterator first, const_iterator last);
 
     constexpr iterator erase(const_iterator first, const_iterator last);
     constexpr void swap(vector&)
+
     constexpr void swap(vector&) noexcept(
      noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value {{!!}}
+
      allocator_traits<Allocator>::propagate_on_container_swap::value {{!!}}
              allocator_traits<Allocator>::is_always_equal::value);
+
      allocator_traits<Allocator>::is_always_equal::value);
 
     static constexpr void swap(reference x, reference y) noexcept;
 
     static constexpr void swap(reference x, reference y) noexcept;
     constexpr void flip() noexcept;     // flips all bits
+
     constexpr void flip() noexcept; // flips all bits
 
     constexpr void clear() noexcept;
 
     constexpr void clear() noexcept;
 +
  };
 +
}
 +
}}
 +
 +
====Class template {{lc|std::formatter}} specialization for {{c/core|std::vector<bool>}}====
 +
{{source|1=
 +
namespace std {
 +
  template<class T, class CharT>
 +
    requires /*is-vector-bool-reference*/<T>
 +
  struct formatter<T, CharT>
 +
  {
 +
  private:
 +
    formatter<bool, CharT> /*underlying_*/; // exposition only
 +
 +
  public:
 +
    template<class ParseContext>
 +
    constexpr typename ParseContext::iterator parse(ParseContext& ctx);
 +
 +
    template<class FormatContext>
 +
    typename FormatContext::iterator format(const T& ref, FormatContext& ctx) const;
 
   };
 
   };
 
}
 
}
 
}}
 
}}

Latest revision as of 03:41, 28 September 2024

#include <compare>
#include <initializer_list>
 
namespace std {
  // class template vector
  template<class T, class Allocator = allocator<T>>
  class vector;
 
  template<class T, class Allocator>
  constexpr bool operator==(const vector<T, Allocator>& x, const vector<T, Allocator>& y);
  template<class T, class Allocator>
  constexpr /*synth-three-way-result*/<T> operator<=>(const vector<T, Allocator>& x,
                                                      const vector<T, Allocator>& y);
 
  template<class T, class Allocator>
  constexpr void swap(vector<T, Allocator>& x,
                      vector<T, Allocator>& y) noexcept(noexcept(x.swap(y)));
 
  // erasure
  template<class T, class Allocator, class U = T>
  constexpr typename vector<T, Allocator>::size_type erase(vector<T, Allocator>& c,
                                                           const U& value);
  template<class T, class Allocator, class Predicate>
  constexpr typename vector<T, Allocator>::size_type erase_if(vector<T, Allocator>& c,
                                                              Predicate pred);
 
  namespace pmr {
    template<class T>
    using vector = std::vector<T, polymorphic_allocator<T>>;
  }
 
  // specialization of vector for bool
  // partial class template specialization vector<bool, Allocator>
  template<class Allocator>
  class vector<bool, Allocator>;
 
  template<class T>
  constexpr bool /*is-vector-bool-reference*/ = /* see description */; // exposition only
 
  // hash support
  template<class T>
  struct hash;
  template<class Allocator>
  struct hash<vector<bool, Allocator>>;
 
  // formatter specialization for vector<bool>
  template<class T, class CharT>
    requires /*is-vector-bool-reference*/<T>
  struct formatter<T, CharT>;
}

[edit] Class template std::vector

namespace std {
  template<class T, class Allocator = allocator<T>>
  class vector
  {
  public:
    // types
    using value_type             = T;
    using allocator_type         = Allocator;
    using pointer                = typename allocator_traits<Allocator>::pointer;
    using const_pointer          = typename allocator_traits<Allocator>::const_pointer;
    using reference              = value_type&;
    using const_reference        = const value_type&;
    using size_type              = /* implementation-defined */;
    using difference_type        = /* implementation-defined */;
    using iterator               = /* implementation-defined */;
    using const_iterator         = /* implementation-defined */;
    using reverse_iterator       = std::reverse_iterator<iterator>;
    using const_reverse_iterator = std::reverse_iterator<const_iterator>;
 
    // construct/copy/destroy
    constexpr vector() noexcept(noexcept(Allocator()))
      : vector(Allocator())
    {
    }
    constexpr explicit vector(const Allocator&) noexcept;
    constexpr explicit vector(size_type n, const Allocator& = Allocator());
    constexpr vector(size_type n, const T& value, const Allocator& = Allocator());
    template<class InputIter>
    constexpr vector(InputIter first, InputIter last, const Allocator& = Allocator());
    template<container-compatible-range<T> R>
    constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
    constexpr vector(const vector& x);
    constexpr vector(vector&&) noexcept;
    constexpr vector(const vector&, const type_identity_t<Allocator>&);
    constexpr vector(vector&&, const type_identity_t<Allocator>&);
    constexpr vector(initializer_list<T>, const Allocator& = Allocator());
    constexpr ~vector();
    constexpr vector& operator=(const vector& x);
    constexpr vector& operator=(vector&& x) noexcept(
      allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
      allocator_traits<Allocator>::is_always_equal::value);
    constexpr vector& operator=(initializer_list<T>);
    template<class InputIter>
    constexpr void assign(InputIter first, InputIter last);
    template<container-compatible-range<T> R>
    constexpr void assign_range(R&& rg);
    constexpr void assign(size_type n, const T& u);
    constexpr void assign(initializer_list<T>);
    constexpr allocator_type get_allocator() const noexcept;
 
    // iterators
    constexpr iterator begin() noexcept;
    constexpr const_iterator begin() const noexcept;
    constexpr iterator end() noexcept;
    constexpr const_iterator end() const noexcept;
    constexpr reverse_iterator rbegin() noexcept;
    constexpr const_reverse_iterator rbegin() const noexcept;
    constexpr reverse_iterator rend() noexcept;
    constexpr const_reverse_iterator rend() const noexcept;
 
    constexpr const_iterator cbegin() const noexcept;
    constexpr const_iterator cend() const noexcept;
    constexpr const_reverse_iterator crbegin() const noexcept;
    constexpr const_reverse_iterator crend() const noexcept;
 
    // capacity
    constexpr bool empty() const noexcept;
    constexpr size_type size() const noexcept;
    constexpr size_type max_size() const noexcept;
    constexpr size_type capacity() const noexcept;
    constexpr void resize(size_type sz);
    constexpr void resize(size_type sz, const T& c);
    constexpr void reserve(size_type n);
    constexpr void shrink_to_fit();
 
    // element access
    constexpr reference operator[](size_type n);
    constexpr const_reference operator[](size_type n) const;
    constexpr const_reference at(size_type n) const;
    constexpr reference at(size_type n);
    constexpr reference front();
    constexpr const_reference front() const;
    constexpr reference back();
    constexpr const_reference back() const;
 
    // data access
    constexpr T* data() noexcept;
    constexpr const T* data() const noexcept;
 
    // modifiers
    template<class... Args>
    constexpr reference emplace_back(Args&&... args);
    constexpr void push_back(const T& x);
    constexpr void push_back(T&& x);
    template<container-compatible-range<T> R>
    constexpr void append_range(R&& rg);
    constexpr void pop_back();
 
    template<class... Args>
    constexpr iterator emplace(const_iterator position, Args&&... args);
    constexpr iterator insert(const_iterator position, const T& x);
    constexpr iterator insert(const_iterator position, T&& x);
    constexpr iterator insert(const_iterator position, size_type n, const T& x);
    template<class InputIter>
    constexpr iterator insert(const_iterator position, InputIter first, InputIter last);
    template<container-compatible-range<T> R>
    constexpr iterator insert_range(const_iterator position, R&& rg);
    constexpr iterator insert(const_iterator position, initializer_list<T> il);
    constexpr iterator erase(const_iterator position);
    constexpr iterator erase(const_iterator first, const_iterator last);
    constexpr void swap(vector&) noexcept(
      allocator_traits<Allocator>::propagate_on_container_swap::value ||
      allocator_traits<Allocator>::is_always_equal::value);
    constexpr void clear() noexcept;
  };
 
  template<class InputIter, class Allocator = allocator</*iter-value-type*/<InputIter>>>
  vector(InputIter, InputIter, Allocator = Allocator())
    -> vector</*iter-value-type*/<InputIter>, Allocator>;
 
  template<ranges::input_range R, class Allocator = allocator<ranges::range_value_t<R>>>
  vector(from_range_t, R&&, Allocator = Allocator())
    -> vector<ranges::range_value_t<R>, Allocator>;
}

[edit] Class template std::vector specialization for bool

namespace std {
  template<class Allocator>
  class vector<bool, Allocator>
  {
  public:
    // types
    using value_type             = bool;
    using allocator_type         = Allocator;
    using pointer                = /* implementation-defined */;
    using const_pointer          = /* implementation-defined */;
    using const_reference        = bool;
    using size_type              = /* implementation-defined */;
    using difference_type        = /* implementation-defined */;
    using iterator               = /* implementation-defined */;
    using const_iterator         = /* implementation-defined */;
    using reverse_iterator       = std::reverse_iterator<iterator>;
    using const_reverse_iterator = std::reverse_iterator<const_iterator>;
 
    // bit reference
    class reference
    {
      constexpr reference() noexcept;
 
    public:
      constexpr reference(const reference&) = default;
      constexpr ~reference();
      constexpr operator bool() const noexcept;
      constexpr reference& operator=(bool x) noexcept;
      constexpr reference& operator=(const reference& x) noexcept;
      constexpr const reference& operator=(bool x) const noexcept;
      constexpr void flip() noexcept; // flips the bit
    };
 
    // construct/copy/destroy
    constexpr vector() noexcept(noexcept(Allocator()))
      : vector(Allocator())
    {
    }
    constexpr explicit vector(const Allocator&) noexcept;
    constexpr explicit vector(size_type n, const Allocator& = Allocator());
    constexpr vector(size_type n, const bool& value, const Allocator& = Allocator());
    template<class InputIter>
    constexpr vector(InputIter first, InputIter last, const Allocator& = Allocator());
    template<container-compatible-range<bool> R>
    constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
    constexpr vector(const vector& x);
    constexpr vector(vector&& x) noexcept;
    constexpr vector(const vector&, const type_identity_t<Allocator>&);
    constexpr vector(vector&&, const type_identity_t<Allocator>&);
    constexpr vector(initializer_list<bool>, const Allocator& = Allocator());
    constexpr ~vector();
    constexpr vector& operator=(const vector& x);
    constexpr vector& operator=(vector&& x) noexcept(
      allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
      allocator_traits<Allocator>::is_always_equal::value);
    constexpr vector& operator=(initializer_list<bool>);
    template<class InputIter>
    constexpr void assign(InputIter first, InputIter last);
    template<container-compatible-range<bool> R>
    constexpr void assign_range(R&& rg);
    constexpr void assign(size_type n, const bool& t);
    constexpr void assign(initializer_list<bool>);
    constexpr allocator_type get_allocator() const noexcept;
 
    // iterators
    constexpr iterator begin() noexcept;
    constexpr const_iterator begin() const noexcept;
    constexpr iterator end() noexcept;
    constexpr const_iterator end() const noexcept;
    constexpr reverse_iterator rbegin() noexcept;
    constexpr const_reverse_iterator rbegin() const noexcept;
    constexpr reverse_iterator rend() noexcept;
    constexpr const_reverse_iterator rend() const noexcept;
 
    constexpr const_iterator cbegin() const noexcept;
    constexpr const_iterator cend() const noexcept;
    constexpr const_reverse_iterator crbegin() const noexcept;
    constexpr const_reverse_iterator crend() const noexcept;
 
    // capacity
    constexpr bool empty() const noexcept;
    constexpr size_type size() const noexcept;
    constexpr size_type max_size() const noexcept;
    constexpr size_type capacity() const noexcept;
    constexpr void resize(size_type sz, bool c = false);
    constexpr void reserve(size_type n);
    constexpr void shrink_to_fit();
 
    // element access
    constexpr reference operator[](size_type n);
    constexpr const_reference operator[](size_type n) const;
    constexpr const_reference at(size_type n) const;
    constexpr reference at(size_type n);
    constexpr reference front();
    constexpr const_reference front() const;
    constexpr reference back();
    constexpr const_reference back() const;
 
    // modifiers
    template<class... Args>
    constexpr reference emplace_back(Args&&... args);
    constexpr void push_back(const bool& x);
    template<container-compatible-range<bool> R>
    constexpr void append_range(R&& rg);
    constexpr void pop_back();
    template<class... Args>
    constexpr iterator emplace(const_iterator position, Args&&... args);
    constexpr iterator insert(const_iterator position, const bool& x);
    constexpr iterator insert(const_iterator position, size_type n, const bool& x);
    template<class InputIter>
    constexpr iterator insert(const_iterator position, InputIter first, InputIter last);
    template<container-compatible-range<bool> R>
    constexpr iterator insert_range(const_iterator position, R&& rg);
    constexpr iterator insert(const_iterator position, initializer_list<bool> il);
 
    constexpr iterator erase(const_iterator position);
    constexpr iterator erase(const_iterator first, const_iterator last);
    constexpr void swap(vector&) noexcept(
      allocator_traits<Allocator>::propagate_on_container_swap::value ||
      allocator_traits<Allocator>::is_always_equal::value);
    static constexpr void swap(reference x, reference y) noexcept;
    constexpr void flip() noexcept; // flips all bits
    constexpr void clear() noexcept;
  };
}

[edit] Class template std::formatter specialization for std::vector<bool>

namespace std {
  template<class T, class CharT>
    requires /*is-vector-bool-reference*/<T>
  struct formatter<T, CharT>
  {
  private:
    formatter<bool, CharT> /*underlying_*/; // exposition only
 
  public:
    template<class ParseContext>
    constexpr typename ParseContext::iterator parse(ParseContext& ctx);
 
    template<class FormatContext>
    typename FormatContext::iterator format(const T& ref, FormatContext& ctx) const;
  };
}