I noticed that std::flat_set
and std::flat_map
container adaptors provide some noexcept member functions, in particular there are the followings:
[[nodiscard]] bool empty() const noexcept;
size_type size() const noexcept;
However, all the other container adaptors provide the same member functions as non-noexcept:
[[nodiscard]] bool empty() const;
size_type size() const;
At first, I agreed with the standard for not introducing the noexcept specific in the member functions, because there is not actually guarantee that the corresponding container's member functions are also noexcept. A possible solution could be introducing a conditionally noexcept, such as in many std::swap
specializations.
So, I do not understand why the same member functions are declared noexcept in std::flat_set
and std::flat_map
.