diff --git a/doc/unordered/unordered_map.adoc b/doc/unordered/unordered_map.adoc index 9610d853..053657d9 100644 --- a/doc/unordered/unordered_map.adoc +++ b/doc/unordered/unordered_map.adoc @@ -87,7 +87,7 @@ namespace boost { const_iterator xref:#unordered_map_cend[cend]() const noexcept; // capacity - bool xref:#unordered_map_empty[empty]() const noexcept; + ++[[nodiscard]]++ bool xref:#unordered_map_empty[empty]() const noexcept; size_type xref:#unordered_map_size[size]() const noexcept; size_type xref:#unordered_map_max_size[max_size]() const noexcept; @@ -633,7 +633,7 @@ Returns:;; A `const_iterator` which refers to the past-the-end value for the con ==== empty ```c++ -bool empty() const noexcept; +[[nodiscard]] bool empty() const noexcept; ``` [horizontal] diff --git a/doc/unordered/unordered_multimap.adoc b/doc/unordered/unordered_multimap.adoc index bd6745f9..d8eae540 100644 --- a/doc/unordered/unordered_multimap.adoc +++ b/doc/unordered/unordered_multimap.adoc @@ -88,7 +88,7 @@ namespace boost { const_iterator xref:#unordered_multimap_cend[cend]() const noexcept; // capacity - bool xref:#unordered_multimap_empty[empty]() const noexcept; + ++[[nodiscard]]++ bool xref:#unordered_multimap_empty[empty]() const noexcept; size_type xref:#unordered_multimap_size[size]() const noexcept; size_type xref:#unordered_multimap_max_size[max_size]() const noexcept; @@ -617,7 +617,7 @@ Returns:;; A `const_iterator` which refers to the past-the-end value for the con ==== empty ```c++ -bool empty() const noexcept; +[[nodiscard]] bool empty() const noexcept; ``` [horizontal] diff --git a/doc/unordered/unordered_multiset.adoc b/doc/unordered/unordered_multiset.adoc index d900799d..0369673e 100644 --- a/doc/unordered/unordered_multiset.adoc +++ b/doc/unordered/unordered_multiset.adoc @@ -84,7 +84,7 @@ namespace boost { const_iterator xref:#unordered_multiset_cend[cend]() const noexcept; // capacity - bool xref:#unordered_multiset_empty[empty]() const noexcept; + ++[[nodiscard]]++ bool xref:#unordered_multiset_empty[empty]() const noexcept; size_type xref:#unordered_multiset_size[size]() const noexcept; size_type xref:#unordered_multiset_max_size[max_size]() const noexcept; @@ -611,7 +611,7 @@ Returns:;; A `const_iterator` which refers to the past-the-end value for the con ==== empty ```c++ -bool empty() const noexcept; +[[nodiscard]] bool empty() const noexcept; ``` [horizontal] diff --git a/doc/unordered/unordered_set.adoc b/doc/unordered/unordered_set.adoc index 1987b317..44670457 100644 --- a/doc/unordered/unordered_set.adoc +++ b/doc/unordered/unordered_set.adoc @@ -85,7 +85,7 @@ namespace boost { const_iterator xref:#unordered_set_cend[cend]() const noexcept; // capacity - bool xref:#unordered_set_empty[empty]() const noexcept; + ++[[nodiscard]]++ bool xref:#unordered_set_empty[empty]() const noexcept; size_type xref:#unordered_set_size[size]() const noexcept; size_type xref:#unordered_set_max_size[max_size]() const noexcept; @@ -622,7 +622,7 @@ Returns:;; A `const_iterator` which refers to the past-the-end value for the con ==== empty ```c++ -bool empty() const noexcept; +[[nodiscard]] bool empty() const noexcept; ``` [horizontal] diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index d5b75cd0..525d74ed 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -210,7 +210,10 @@ namespace boost { // size and capacity - bool empty() const BOOST_NOEXCEPT { return table_.size_ == 0; } + BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + { + return table_.size_ == 0; + } size_type size() const BOOST_NOEXCEPT { return table_.size_; } @@ -1177,7 +1180,10 @@ namespace boost { // size and capacity - bool empty() const BOOST_NOEXCEPT { return table_.size_ == 0; } + BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + { + return table_.size_ == 0; + } size_type size() const BOOST_NOEXCEPT { return table_.size_; } @@ -2719,7 +2725,10 @@ namespace boost { bool operator!() const BOOST_NOEXCEPT { return ptr_ ? 0 : 1; } - bool empty() const BOOST_NOEXCEPT { return ptr_ ? 0 : 1; } + BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + { + return ptr_ ? 0 : 1; + } void swap(node_handle_map& n) BOOST_NOEXCEPT_IF( value_allocator_traits::propagate_on_container_swap::value || diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index ab096b04..b997defd 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -208,7 +208,10 @@ namespace boost { // size and capacity - bool empty() const BOOST_NOEXCEPT { return table_.size_ == 0; } + BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + { + return table_.size_ == 0; + } size_type size() const BOOST_NOEXCEPT { return table_.size_; } @@ -835,7 +838,10 @@ namespace boost { // size and capacity - bool empty() const BOOST_NOEXCEPT { return table_.size_ == 0; } + BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + { + return table_.size_ == 0; + } size_type size() const BOOST_NOEXCEPT { return table_.size_; } @@ -2183,7 +2189,10 @@ namespace boost { bool operator!() const BOOST_NOEXCEPT { return ptr_ ? 0 : 1; } - bool empty() const BOOST_NOEXCEPT { return ptr_ ? 0 : 1; } + BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT + { + return ptr_ ? 0 : 1; + } void swap(node_handle_set& n) BOOST_NOEXCEPT_IF( value_allocator_traits::propagate_on_container_swap::value ||