vector<bool> missing exception specifications
Alisdair Meredith

Created on 2022-09-13.00:00:00 last changed 2 weeks ago


Date: 2022-11-17.00:42:33

Proposed resolution:

This wording is relative to N4917.

  1. Modify [vector.bool.pspc], partial class template vector<bool, Allocator> synopsis, as indicated:

    namespace std {
      template<class Allocator>
      class vector<bool, Allocator> {
        // 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 InputIterator>
          constexpr vector(InputIterator first, InputIterator 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 ||
        constexpr vector& operator=(initializer_list<bool>);
        template<class InputIterator>
          constexpr void assign(InputIterator first, InputIterator 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;
        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 ||
        constexpr static void swap(reference x, reference y) noexcept;
        constexpr void flip() noexcept; // flips all bits
        constexpr void clear() noexcept;
Date: 2022-11-12.00:00:00

[ 2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP. ]

Date: 2022-09-15.00:00:00

[ 2022-09-28; Reflector poll ]

Set status to Tentatively Ready after seven votes in favour during reflector poll.

Date: 2022-09-13.00:00:00

As noted back in P0177R2, the primary template for vector has picked up some exception specification, but the partial specialization for vector<bool> has not been so updated.

Several other changes have been made to vector in the intervening years, but these particular exception specifications have still not been updated. Note that the free-function swap in the header synopsis will automatically pick up this update once applied.

Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-11-17 00:42:33adminsetmessages: + msg13077
2022-11-17 00:42:33adminsetstatus: voting -> wp
2022-11-08 03:46:49adminsetstatus: ready -> voting
2022-09-29 08:33:27adminsetmessages: + msg12832
2022-09-29 08:33:27adminsetstatus: new -> ready
2022-09-17 14:46:48adminsetmessages: + msg12769
2022-09-13 00:00:00admincreate