@@ -320,7 +320,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* [__first1,__last1-(__last2-__first2))
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
@@ -370,7 +370,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
@@ -405,7 +405,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @p [__first,__last), and false otherwise.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return __last == std::find_if_not(__first, __last, __pred); }
@@ -423,7 +423,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @p [__first,__last), and false otherwise.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); }
@@ -442,7 +442,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* otherwise.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{ return !std::none_of(__first, __last, __pred); }
@@ -458,7 +458,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* such that @p __pred(*i) is false, or @p __last if no such iterator exists.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _InputIterator
find_if_not(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
@@ -483,7 +483,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* do not.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_partitioned(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
@@ -505,7 +505,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* and @p none_of(mid, __last, __pred) are both true.
*/
template<typename _ForwardIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_ForwardIterator
partition_point(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
@@ -783,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
remove(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __value)
@@ -817,7 +817,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
remove_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
@@ -886,7 +886,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last)
{
@@ -917,7 +917,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
@@ -1958,7 +1958,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* the function used for the initial sort.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
@@ -2014,7 +2014,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* @ingroup binary_search_algorithms
*/
template<typename _ForwardIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
@@ -2045,7 +2045,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* the function used for the initial sort.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
@@ -2118,7 +2118,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* but does not actually call those functions.
*/
template<typename _ForwardIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
@@ -2155,7 +2155,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* but does not actually call those functions.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
@@ -2189,7 +2189,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* that, use std::find or a container's specialized find member functions.
*/
template<typename _ForwardIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
@@ -2223,7 +2223,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* the function used for the initial sort.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
@@ -2803,7 +2803,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* returned.
*/
template<typename _InputIterator1, typename _InputIterator2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2)
@@ -2849,7 +2849,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
@@ -3186,7 +3186,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* @return True if the elements are sorted, false otherwise.
*/
template<typename _ForwardIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last)
{ return std::is_sorted_until(__first, __last) == __last; }
@@ -3201,7 +3201,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* @return True if the elements are sorted, false otherwise.
*/
template<typename _ForwardIterator, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_sorted(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
@@ -3232,7 +3232,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* for which the range [__first, i) is sorted.
*/
template<typename _ForwardIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
{
@@ -3257,7 +3257,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* for which the range [__first, i) is sorted.
*/
template<typename _ForwardIterator, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
@@ -3283,7 +3283,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* __b) otherwise.
*/
template<typename _Tp>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline pair<const _Tp&, const _Tp&>
minmax(const _Tp& __a, const _Tp& __b)
{
@@ -3304,7 +3304,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* __b) otherwise.
*/
template<typename _Tp, typename _Compare>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline pair<const _Tp&, const _Tp&>
minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
@@ -3384,7 +3384,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* such that no other element in the range is larger.
*/
template<typename _ForwardIterator>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline pair<_ForwardIterator, _ForwardIterator>
minmax_element(_ForwardIterator __first, _ForwardIterator __last)
{
@@ -3412,7 +3412,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* such that no other element in the range is larger.
*/
template<typename _ForwardIterator, typename _Compare>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline pair<_ForwardIterator, _ForwardIterator>
minmax_element(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
@@ -3430,7 +3430,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
}
template<typename _Tp>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __l)
{
@@ -3442,7 +3442,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
}
template<typename _Tp, typename _Compare>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline pair<_Tp, _Tp>
minmax(initializer_list<_Tp> __l, _Compare __comp)
{
@@ -3469,7 +3469,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _BinaryPredicate __pred)
@@ -3563,7 +3563,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* otherwise, returns false.
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
@@ -3592,7 +3592,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
@@ -3619,7 +3619,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* @pre `_Tp` is LessThanComparable and `(__hi < __lo)` is false.
*/
template<typename _Tp>
- constexpr const _Tp&
+ [[nodiscard]] constexpr const _Tp&
clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi)
{
__glibcxx_assert(!(__hi < __lo));
@@ -3639,7 +3639,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
* @pre `__comp(__hi, __lo)` is false.
*/
template<typename _Tp, typename _Compare>
- constexpr const _Tp&
+ [[nodiscard]] constexpr const _Tp&
clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi, _Compare __comp)
{
__glibcxx_assert(!__comp(__hi, __lo));
@@ -3861,7 +3861,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* such that @p __pred(*i) is true, or @p __last if no such iterator exists.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _InputIterator
find_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
@@ -3893,7 +3893,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* otherwise returns @p __last1.
*/
template<typename _InputIterator, typename _ForwardIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_InputIterator
find_first_of(_InputIterator __first1, _InputIterator __last1,
_ForwardIterator __first2, _ForwardIterator __last2)
@@ -3935,7 +3935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator, typename _ForwardIterator,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
_InputIterator
find_first_of(_InputIterator __first1, _InputIterator __last1,
_ForwardIterator __first2, _ForwardIterator __last2,
@@ -3967,7 +3967,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* or @p __last if no such iterator exists.
*/
template<typename _ForwardIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
{
@@ -3993,7 +3993,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* exists.
*/
template<typename _ForwardIterator, typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
@@ -4019,7 +4019,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* for which @c *i == @p __value
*/
template<typename _InputIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline typename iterator_traits<_InputIterator>::difference_type
count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
{
@@ -4043,7 +4043,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* for which @p __pred(*i) is true.
*/
template<typename _InputIterator, typename _Predicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline typename iterator_traits<_InputIterator>::difference_type
count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{
@@ -4084,7 +4084,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @p [__first1,__last1-(__last2-__first2))
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator1
search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
@@ -4118,7 +4118,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* equal to @p __val.
*/
template<typename _ForwardIterator, typename _Integer, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val)
@@ -4153,7 +4153,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _ForwardIterator, typename _Integer, typename _Tp,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val,
@@ -4178,7 +4178,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @return @p __searcher(__first,__last).first
*/
template<typename _ForwardIterator, typename _Searcher>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
search(_ForwardIterator __first, _ForwardIterator __last,
const _Searcher& __searcher)
@@ -5571,7 +5571,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @return Iterator referencing the first instance of the smallest value.
*/
template<typename _ForwardIterator>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
_ForwardIterator
inline min_element(_ForwardIterator __first, _ForwardIterator __last)
{
@@ -5596,7 +5596,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* according to __comp.
*/
template<typename _ForwardIterator, typename _Compare>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline _ForwardIterator
min_element(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
@@ -5635,7 +5635,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @return Iterator referencing the first instance of the largest value.
*/
template<typename _ForwardIterator>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline _ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last)
{
@@ -5660,7 +5660,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* according to __comp.
*/
template<typename _ForwardIterator, typename _Compare>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline _ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
@@ -228,7 +228,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* preprocessor macro.
*/
template<typename _Tp>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline const _Tp&
min(const _Tp& __a, const _Tp& __b)
{
@@ -252,7 +252,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* preprocessor macro.
*/
template<typename _Tp>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline const _Tp&
max(const _Tp& __a, const _Tp& __b)
{
@@ -276,7 +276,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* once, unlike a preprocessor macro.
*/
template<typename _Tp, typename _Compare>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline const _Tp&
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
@@ -298,7 +298,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* once, unlike a preprocessor macro.
*/
template<typename _Tp, typename _Compare>
- _GLIBCXX14_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR
inline const _Tp&
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
@@ -1522,7 +1522,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
* @ingroup binary_search_algorithms
*/
template<typename _ForwardIterator, typename _Tp>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
@@ -1571,7 +1571,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* ranges are equal.
*/
template<typename _II1, typename _II2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
equal(_II1 __first1, _II1 __last1, _II2 __first2)
{
@@ -1602,7 +1602,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* ranges are equal.
*/
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
equal(_IIter1 __first1, _IIter1 __last1,
_IIter2 __first2, _BinaryPredicate __binary_pred)
@@ -1689,7 +1689,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* ranges are equal.
*/
template<typename _II1, typename _II2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
{
@@ -1722,7 +1722,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* ranges are equal.
*/
template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
equal(_IIter1 __first1, _IIter1 __last1,
_IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
@@ -1754,7 +1754,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* then this is an inline call to @c memcmp.
*/
template<typename _II1, typename _II2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
lexicographical_compare(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2)
@@ -1789,7 +1789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* comp parameter instead of @c <.
*/
template<typename _II1, typename _II2, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
lexicographical_compare(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2, _Compare __comp)
@@ -1843,7 +1843,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* returns.
*/
template<typename _InputIter1, typename _InputIter2, typename _Comp>
- constexpr auto
+ [[nodiscard]] constexpr auto
lexicographical_compare_three_way(_InputIter1 __first1,
_InputIter1 __last1,
_InputIter2 __first2,
@@ -1932,7 +1932,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* to by the iterators are not equal.
*/
template<typename _InputIterator1, typename _InputIterator2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2)
@@ -1967,7 +1967,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _BinaryPredicate __binary_pred)
@@ -2014,7 +2014,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* to by the iterators are not equal.
*/
template<typename _InputIterator1, typename _InputIterator2>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2)
@@ -2051,7 +2051,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
@@ -492,7 +492,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the range [__first, i) is a heap.
*/
template<typename _RandomAccessIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _RandomAccessIterator
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
@@ -521,7 +521,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the range [__first, i) is a heap. Comparisons are made using __comp.
*/
template<typename _RandomAccessIterator, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline _RandomAccessIterator
is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
@@ -546,7 +546,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup heap_algorithms
*/
template<typename _RandomAccessIterator>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ return std::is_heap_until(__first, __last) == __last; }
@@ -560,7 +560,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup heap_algorithms
*/
template<typename _RandomAccessIterator, typename _Compare>
- _GLIBCXX20_CONSTEXPR
+ _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
inline bool
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
@@ -27,6 +27,7 @@ test01()
std::vector<int> vect;
vect.push_back(1);
std::equal(vect.end(), vect.begin(), vect.begin());
+ // { dg-warning "ignoring return value" "" { target c++17 } 29 }
}
int
@@ -27,6 +27,7 @@ test01()
std::vector<int> v1, v2;
v1.push_back(1);
std::equal(v1.begin(), v1.end(), v2.begin());
+ // { dg-warning "ignoring return value" "" { target c++17 } 29 }
}
int
@@ -33,6 +33,7 @@ test01()
l2.push_back(2);
std::equal(++l1.begin(), l1.end(), ++l2.begin());
+ // { dg-warning "ignoring return value" "" { target c++17 } 35 }
}
int
@@ -37,6 +37,7 @@ class2 b;
void test01()
{
std::find_first_of(&a, &a, &b, &b, comp);
+ // { dg-warning "ignoring return value" "" { target c++17 } 39 }
}
int main()
@@ -103,6 +103,7 @@ void test02()
int arr[] = { 11, 22, 33 };
using namespace std;
is_permutation(begin(arr0), end(arr0), begin(arr), end(arr), thrower);
+ // { dg-warning "ignoring return value" "" { target c++17 } 105 }
}
int main()
@@ -33,4 +33,5 @@ int main()
X x[1];
int i[1];
std::lexicographical_compare(x, x+1, i, i+1);
+ // { dg-warning "ignoring return value" "" { target c++17 } 35 }
}
@@ -33,4 +33,5 @@ bool ab(A, B);
void test01(A* a, B b)
{
std::lower_bound(a, a, b, ab);
+ // { dg-warning "ignoring return value" "" { target c++17 } 35 }
}
@@ -44,4 +44,5 @@ void test01()
{
A as[] = { 0, 1, 2, 3 };
std::lower_bound(as, as + 4, 1, A_int_comparer());
+ // { dg-warning "ignoring return value" "" { target c++17 } 46 }
}
@@ -36,6 +36,7 @@ void test01()
{
A as[] = { 0, 1, 2, 0, 2, 3 };
std::lower_bound(as, as + 6, A(1));
+ // { dg-warning "ignoring return value" "" { target c++17 } 38 }
}
int
@@ -24,6 +24,7 @@ void test01()
{
int as[] = { 0, 1, 0, 2, 3 };
std::lower_bound(as, as + 5, 1, std::less<int>());
+ // { dg-warning "ignoring return value" "" { target c++17 } 26 }
}
@@ -43,6 +43,7 @@ int compare_counter::count = 0;
void test01()
{
std::minmax({1, 2, 3, 4, 5, 6, 7, 8}, compare_counter());
+ // { dg-warning "ignoring return value" "" { target c++17 } 45 }
// If N is the number of arguments in the minmax function call,
// 25.3.7 specifies that at most 3N/2 comparisons are allowed.
@@ -109,6 +109,7 @@ test01()
{
value s[] = { 0, 1, 2, 3, 4, 5 };
std::search(s, s+6, stashing_iterator(s), stashing_iterator(s+4));
+ // { dg-warning "ignoring return value" "" { target c++17 } 111 }
}
int
@@ -29,6 +29,7 @@ void test01()
int count = 0;
std::search_n(a.begin(), a.end(), 10, 1,
[&count](int t, int u) { ++count; return t == u; });
+ // { dg-warning "ignoring return value" "" { target c++17 } 30 }
VERIFY( count <= 11 );
}
@@ -27,5 +27,6 @@ int main()
using namespace std;
list<int> menge;
unique (menge.begin(), menge.end());
+ // { dg-warning "ignoring return value" "" { target c++17 } 29 }
return 0;
}
@@ -31,7 +31,7 @@ bool compare(int a, int b)
// libstdc++/11480
void test01()
{
- std::unique(a, a+10, compare);
+ std::unique(a, a+10, compare); // { dg-warning "ignoring return value" "" { target c++17 } }
VERIFY( compare_count == 9 );
}
@@ -33,4 +33,5 @@ bool ba(B, A);
void test01(A* a, B b)
{
std::upper_bound(a, a, b, ba);
+ // { dg-warning "ignoring return value" "" { target c++17 } 35 }
}
@@ -36,6 +36,7 @@ void test01()
{
A as[] = { 0, 2, 1, 3, 4, 5 };
std::upper_bound(as, as + 6, A(1));
+ // { dg-warning "ignoring return value" "" { target c++17 } 38 }
}
int
@@ -24,6 +24,7 @@ void test01()
{
int as[] = { 0, 2, 1, 3, 4 };
std::upper_bound(as, as + 5, 1, std::less<int>());
+ // { dg-warning "ignoring return value" "" { target c++17 } 26 }
}
@@ -73,6 +73,10 @@ test2054( )
upper_bound(Index.begin(), Index.end(), SearchTerm, aComparison);
equal_range(Index.begin(), Index.end(), SearchTerm, aComparison);
binary_search(Index.begin(), Index.end(), SearchTerm, aComparison);
+ // { dg-warning "ignoring return value" "" { target c++17 } 72 }
+ // { dg-warning "ignoring return value" "" { target c++17 } 73 }
+ // { dg-warning "ignoring return value" "" { target c++17 } 74 }
+ // { dg-warning "ignoring return value" "" { target c++17 } 75 }
}
int main()
@@ -25,4 +25,5 @@ void foo()
{
std::vector<int> v;
is_heap(v.begin(), v.end());
+ // { dg-warning "ignoring return value" "" { target c++17 } 27 }
}
@@ -24,4 +24,5 @@ void foo()
{
std::vector<int> v;
is_sorted(v.begin(), v.end());
+ // { dg-warning "ignoring return value" "" { target c++17 } 26 }
}