diff --git a/include/nanorange/algorithm/adjacent_find.hpp b/include/nanorange/algorithm/adjacent_find.hpp index 2e87c8b..698963c 100644 --- a/include/nanorange/algorithm/adjacent_find.hpp +++ b/include/nanorange/algorithm/adjacent_find.hpp @@ -44,7 +44,7 @@ struct adjacent_find_fn { public: template - constexpr std::enable_if_t && sentinel_for && + [[nodiscard]] constexpr std::enable_if_t && sentinel_for && indirect_relation>, I> operator()(I first, S last, Pred pred = Pred{}, Proj proj = Proj{}) const @@ -55,7 +55,7 @@ struct adjacent_find_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && indirect_relation, Proj>>, borrowed_iterator_t> diff --git a/include/nanorange/algorithm/all_of.hpp b/include/nanorange/algorithm/all_of.hpp index 615333b..649f3c6 100644 --- a/include/nanorange/algorithm/all_of.hpp +++ b/include/nanorange/algorithm/all_of.hpp @@ -31,7 +31,7 @@ struct all_of_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_unary_predicate>, bool> @@ -42,7 +42,7 @@ struct all_of_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_unary_predicate, Proj>>, bool> diff --git a/include/nanorange/algorithm/any_of.hpp b/include/nanorange/algorithm/any_of.hpp index df25a86..74559cf 100644 --- a/include/nanorange/algorithm/any_of.hpp +++ b/include/nanorange/algorithm/any_of.hpp @@ -34,7 +34,7 @@ struct any_of_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_unary_predicate>, bool> @@ -45,7 +45,7 @@ struct any_of_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_unary_predicate, Proj>>, bool> diff --git a/include/nanorange/algorithm/binary_search.hpp b/include/nanorange/algorithm/binary_search.hpp index 842bc87..afe4e79 100644 --- a/include/nanorange/algorithm/binary_search.hpp +++ b/include/nanorange/algorithm/binary_search.hpp @@ -26,7 +26,7 @@ struct binary_search_fn { public: template - std::enable_if_t< + [[nodiscard]] std::enable_if_t< forward_iterator && sentinel_for && indirect_strict_weak_order>, bool> @@ -39,7 +39,7 @@ struct binary_search_fn { template - std::enable_if_t && + [[nodiscard]] std::enable_if_t && indirect_strict_weak_order, Proj>>, bool> constexpr operator()(Rng&& rng, const T& value, Comp comp = Comp{}, diff --git a/include/nanorange/algorithm/clamp.hpp b/include/nanorange/algorithm/clamp.hpp index aa4d673..3ac2021 100644 --- a/include/nanorange/algorithm/clamp.hpp +++ b/include/nanorange/algorithm/clamp.hpp @@ -15,7 +15,7 @@ namespace detail { struct clamp_fn { template - constexpr std::enable_if_t>, const T&> + [[nodiscard]] constexpr std::enable_if_t>, const T&> operator()(const T& value, const T& low, const T& high, Comp comp = {}, Proj proj = Proj{}) const { auto&& projected_value = nano::invoke(proj, value); diff --git a/include/nanorange/algorithm/count.hpp b/include/nanorange/algorithm/count.hpp index f33b232..b4909c9 100644 --- a/include/nanorange/algorithm/count.hpp +++ b/include/nanorange/algorithm/count.hpp @@ -37,7 +37,7 @@ struct count_if_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_unary_predicate>, iter_difference_t> @@ -48,7 +48,7 @@ struct count_if_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_unary_predicate, Proj>>, range_difference_t> @@ -66,7 +66,7 @@ namespace detail { struct count_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_relation, const T*>, iter_difference_t> @@ -78,7 +78,7 @@ struct count_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_relation, Proj>, const T*>, diff --git a/include/nanorange/algorithm/equal.hpp b/include/nanorange/algorithm/equal.hpp index c0dc663..b71c53c 100644 --- a/include/nanorange/algorithm/equal.hpp +++ b/include/nanorange/algorithm/equal.hpp @@ -55,7 +55,7 @@ struct equal_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && input_iterator && sentinel_for && indirectly_comparable && @@ -79,7 +79,7 @@ struct equal_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && input_iterator && sentinel_for && indirectly_comparable && @@ -112,7 +112,7 @@ struct equal_fn { // Two ranges, both sized template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && input_range && indirectly_comparable, iterator_t, Pred, Proj1, Proj2> && @@ -132,7 +132,7 @@ struct equal_fn { // Two ranges, not both sized template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && input_range && indirectly_comparable, iterator_t, Pred, Proj1, Proj2> && diff --git a/include/nanorange/algorithm/equal_range.hpp b/include/nanorange/algorithm/equal_range.hpp index 5306d4d..2b47dbf 100644 --- a/include/nanorange/algorithm/equal_range.hpp +++ b/include/nanorange/algorithm/equal_range.hpp @@ -28,7 +28,7 @@ struct equal_range_fn { public: template - std::enable_if_t< + [[nodiscard]] std::enable_if_t< forward_iterator && sentinel_for && indirect_strict_weak_order>, subrange> @@ -41,7 +41,7 @@ struct equal_range_fn { template - std::enable_if_t && + [[nodiscard]] std::enable_if_t && indirect_strict_weak_order, Proj>>, borrowed_subrange_t> constexpr operator()(Rng&& rng, const T& value, Comp comp = Comp{}, diff --git a/include/nanorange/algorithm/find.hpp b/include/nanorange/algorithm/find.hpp index 72b6b70..738db52 100644 --- a/include/nanorange/algorithm/find.hpp +++ b/include/nanorange/algorithm/find.hpp @@ -34,7 +34,7 @@ struct find_if_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_unary_predicate>, I> @@ -44,7 +44,7 @@ struct find_if_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_unary_predicate, Proj>>, borrowed_iterator_t> @@ -61,7 +61,7 @@ namespace detail { struct find_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_relation, const T*>, I> @@ -72,7 +72,7 @@ struct find_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_relation, Proj>, const T*>, @@ -104,7 +104,7 @@ struct find_if_not_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_unary_predicate>, I> @@ -116,7 +116,7 @@ struct find_if_not_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_unary_predicate, Proj>>, borrowed_iterator_t> diff --git a/include/nanorange/algorithm/find_end.hpp b/include/nanorange/algorithm/find_end.hpp index 04a5177..57883aa 100644 --- a/include/nanorange/algorithm/find_end.hpp +++ b/include/nanorange/algorithm/find_end.hpp @@ -50,7 +50,7 @@ struct find_end_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && forward_iterator && sentinel_for && indirectly_comparable, @@ -65,7 +65,7 @@ struct find_end_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && forward_range && indirectly_comparable, iterator_t, Pred, Proj1, Proj2>, borrowed_subrange_t> diff --git a/include/nanorange/algorithm/find_first_of.hpp b/include/nanorange/algorithm/find_first_of.hpp index 575669f..344792e 100644 --- a/include/nanorange/algorithm/find_first_of.hpp +++ b/include/nanorange/algorithm/find_first_of.hpp @@ -38,7 +38,7 @@ struct find_first_of_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && forward_iterator && sentinel_for && indirect_relation, projected>, @@ -53,7 +53,7 @@ struct find_first_of_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && forward_range && indirect_relation, Proj1>, projected, Proj2>>, @@ -73,4 +73,4 @@ NANO_INLINE_VAR(detail::find_first_of_fn, find_first_of) NANO_END_NAMESPACE -#endif \ No newline at end of file +#endif diff --git a/include/nanorange/algorithm/includes.hpp b/include/nanorange/algorithm/includes.hpp index aa74de9..42e6dbe 100644 --- a/include/nanorange/algorithm/includes.hpp +++ b/include/nanorange/algorithm/includes.hpp @@ -51,7 +51,7 @@ struct includes_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && input_iterator && sentinel_for && indirect_strict_weak_order, projected>, @@ -66,7 +66,7 @@ struct includes_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && input_range && indirect_strict_weak_order, Proj1>, diff --git a/include/nanorange/algorithm/is_heap.hpp b/include/nanorange/algorithm/is_heap.hpp index 0997bd9..f1d1b6b 100644 --- a/include/nanorange/algorithm/is_heap.hpp +++ b/include/nanorange/algorithm/is_heap.hpp @@ -16,7 +16,7 @@ namespace detail { struct is_heap_fn { template - std::enable_if_t && sentinel_for && + [[nodiscard]] std::enable_if_t && sentinel_for && indirect_strict_weak_order>, bool> operator()(I first, S last, Comp comp = Comp{}, Proj proj = Proj{}) const @@ -26,7 +26,7 @@ struct is_heap_fn { } template - std::enable_if_t< + [[nodiscard]] std::enable_if_t< random_access_range && indirect_strict_weak_order, Proj>>, bool> diff --git a/include/nanorange/algorithm/is_heap_until.hpp b/include/nanorange/algorithm/is_heap_until.hpp index 431e46b..f35dee8 100644 --- a/include/nanorange/algorithm/is_heap_until.hpp +++ b/include/nanorange/algorithm/is_heap_until.hpp @@ -58,7 +58,7 @@ struct is_heap_until_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< random_access_iterator && sentinel_for && indirect_strict_weak_order>, I> @@ -69,7 +69,7 @@ struct is_heap_until_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< random_access_range && indirect_strict_weak_order, Proj>>, borrowed_iterator_t> diff --git a/include/nanorange/algorithm/is_partitioned.hpp b/include/nanorange/algorithm/is_partitioned.hpp index f07d6a8..74d84c8 100644 --- a/include/nanorange/algorithm/is_partitioned.hpp +++ b/include/nanorange/algorithm/is_partitioned.hpp @@ -24,7 +24,7 @@ struct is_partitioned_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_unary_predicate>, bool> operator()(I first, S last, Pred pred = Pred{}, Proj proj = Proj{}) const @@ -34,7 +34,7 @@ struct is_partitioned_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_unary_predicate, Proj>>, bool> operator()(Rng&& rng, Pred pred = Pred{}, Proj proj = Proj{}) const diff --git a/include/nanorange/algorithm/is_permutation.hpp b/include/nanorange/algorithm/is_permutation.hpp index d368820..ced2955 100644 --- a/include/nanorange/algorithm/is_permutation.hpp +++ b/include/nanorange/algorithm/is_permutation.hpp @@ -114,7 +114,7 @@ struct is_permutation_fn { template - constexpr + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && forward_iterator && sentinel_for && @@ -160,7 +160,7 @@ struct is_permutation_fn { // Two ranges template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && forward_range && indirectly_comparable, iterator_t, Pred, Proj1, Proj2>, diff --git a/include/nanorange/algorithm/is_sorted.hpp b/include/nanorange/algorithm/is_sorted.hpp index f1e14bb..a3c8e96 100644 --- a/include/nanorange/algorithm/is_sorted.hpp +++ b/include/nanorange/algorithm/is_sorted.hpp @@ -16,7 +16,7 @@ namespace detail { struct is_sorted_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && indirect_strict_weak_order>, bool> operator()(I first, S last, Comp comp = Comp{}, Proj proj = Proj{}) const @@ -26,7 +26,7 @@ struct is_sorted_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && indirect_strict_weak_order, Proj>>, bool> diff --git a/include/nanorange/algorithm/is_sorted_until.hpp b/include/nanorange/algorithm/is_sorted_until.hpp index 2f8370c..fdb6c37 100644 --- a/include/nanorange/algorithm/is_sorted_until.hpp +++ b/include/nanorange/algorithm/is_sorted_until.hpp @@ -41,7 +41,7 @@ struct is_sorted_until_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && indirect_strict_weak_order>, I> operator()(I first, S last, Comp comp = Comp{}, Proj proj = Proj{}) const @@ -51,7 +51,7 @@ struct is_sorted_until_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && indirect_strict_weak_order, Proj>>, borrowed_iterator_t> diff --git a/include/nanorange/algorithm/lexicographical_compare.hpp b/include/nanorange/algorithm/lexicographical_compare.hpp index b4171fe..9198b9a 100644 --- a/include/nanorange/algorithm/lexicographical_compare.hpp +++ b/include/nanorange/algorithm/lexicographical_compare.hpp @@ -39,7 +39,7 @@ struct lexicographical_compare_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && input_iterator && sentinel_for && indirect_strict_weak_order, projected>, @@ -55,7 +55,7 @@ struct lexicographical_compare_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && input_range && indirect_strict_weak_order, Proj1>, projected, Proj2>>, diff --git a/include/nanorange/algorithm/lower_bound.hpp b/include/nanorange/algorithm/lower_bound.hpp index ab682ea..589576d 100644 --- a/include/nanorange/algorithm/lower_bound.hpp +++ b/include/nanorange/algorithm/lower_bound.hpp @@ -42,7 +42,7 @@ struct lower_bound_fn { public: template - std::enable_if_t< + [[nodiscard]] std::enable_if_t< forward_iterator && sentinel_for && indirect_strict_weak_order>, I> @@ -55,7 +55,7 @@ struct lower_bound_fn { template - std::enable_if_t && + [[nodiscard]] std::enable_if_t && indirect_strict_weak_order, Proj>>, borrowed_iterator_t> constexpr operator()(Rng&& rng, const T& value, Comp comp = Comp{}, diff --git a/include/nanorange/algorithm/max.hpp b/include/nanorange/algorithm/max.hpp index 4f69454..70b9f53 100644 --- a/include/nanorange/algorithm/max.hpp +++ b/include/nanorange/algorithm/max.hpp @@ -38,7 +38,7 @@ struct max_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< indirect_strict_weak_order>, const T&> operator()(const T& a, const T& b, Comp comp = Comp{}, Proj proj = Proj{}) const @@ -49,7 +49,7 @@ struct max_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< copyable && indirect_strict_weak_order>, T> @@ -60,7 +60,7 @@ struct max_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && copyable>> && indirect_strict_weak_order, Proj>>, range_value_t> diff --git a/include/nanorange/algorithm/max_element.hpp b/include/nanorange/algorithm/max_element.hpp index 9ac2053..cb620b6 100644 --- a/include/nanorange/algorithm/max_element.hpp +++ b/include/nanorange/algorithm/max_element.hpp @@ -36,7 +36,7 @@ struct max_element_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && indirect_strict_weak_order>, I> operator()(I first, S last, Comp comp = Comp{}, Proj proj = Proj{}) const @@ -46,7 +46,7 @@ struct max_element_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && indirect_strict_weak_order, Proj>>, borrowed_iterator_t> diff --git a/include/nanorange/algorithm/min.hpp b/include/nanorange/algorithm/min.hpp index 2c6d546..df8a52e 100644 --- a/include/nanorange/algorithm/min.hpp +++ b/include/nanorange/algorithm/min.hpp @@ -38,7 +38,7 @@ struct min_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< indirect_strict_weak_order>, const T&> operator()(const T& a, const T& b, Comp comp = Comp{}, Proj proj = Proj{}) const @@ -48,7 +48,7 @@ struct min_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< copyable && indirect_strict_weak_order>, T> @@ -59,7 +59,7 @@ struct min_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && copyable>> && indirect_strict_weak_order, Proj>>, range_value_t> diff --git a/include/nanorange/algorithm/min_element.hpp b/include/nanorange/algorithm/min_element.hpp index a17af9c..aacdd08 100644 --- a/include/nanorange/algorithm/min_element.hpp +++ b/include/nanorange/algorithm/min_element.hpp @@ -39,7 +39,7 @@ struct min_element_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && indirect_strict_weak_order>, I> operator()(I first, S last, Comp comp = Comp{}, Proj proj = Proj{}) const @@ -49,7 +49,7 @@ struct min_element_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && indirect_strict_weak_order, Proj>>, borrowed_iterator_t> diff --git a/include/nanorange/algorithm/mismatch.hpp b/include/nanorange/algorithm/mismatch.hpp index 8bed56f..87020d7 100644 --- a/include/nanorange/algorithm/mismatch.hpp +++ b/include/nanorange/algorithm/mismatch.hpp @@ -93,7 +93,7 @@ struct mismatch_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && input_iterator && sentinel_for && indirect_relation, projected>, @@ -109,7 +109,7 @@ struct mismatch_fn { // two ranges template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && input_range && indirect_relation, Proj1>, projected, Proj2>>, diff --git a/include/nanorange/algorithm/none_of.hpp b/include/nanorange/algorithm/none_of.hpp index 1d6b360..1c06c19 100644 --- a/include/nanorange/algorithm/none_of.hpp +++ b/include/nanorange/algorithm/none_of.hpp @@ -18,7 +18,7 @@ namespace detail { struct none_of_fn { template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_iterator && sentinel_for && indirect_unary_predicate>, bool> @@ -28,7 +28,7 @@ struct none_of_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< input_range && indirect_unary_predicate, Proj>>, bool> @@ -45,4 +45,4 @@ NANO_INLINE_VAR(detail::none_of_fn, none_of) NANO_END_NAMESPACE -#endif \ No newline at end of file +#endif diff --git a/include/nanorange/algorithm/partition.hpp b/include/nanorange/algorithm/partition.hpp index 0f39cbb..3453573 100644 --- a/include/nanorange/algorithm/partition.hpp +++ b/include/nanorange/algorithm/partition.hpp @@ -40,7 +40,7 @@ struct partition_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && indirect_unary_predicate>, subrange> operator()(I first, S last, Pred pred, Proj proj = Proj{}) const @@ -50,7 +50,7 @@ struct partition_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && indirect_unary_predicate, Proj>>, borrowed_subrange_t> diff --git a/include/nanorange/algorithm/partition_point.hpp b/include/nanorange/algorithm/partition_point.hpp index d2aad61..347cc45 100644 --- a/include/nanorange/algorithm/partition_point.hpp +++ b/include/nanorange/algorithm/partition_point.hpp @@ -85,7 +85,7 @@ struct partition_point_fn { public: template - std::enable_if_t && sentinel_for && + [[nodiscard]] std::enable_if_t && sentinel_for && indirect_unary_predicate>, I> constexpr operator()(I first, S last, Pred pred, Proj proj = Proj{}) const { @@ -94,7 +94,7 @@ struct partition_point_fn { } template - std::enable_if_t< + [[nodiscard]] std::enable_if_t< forward_range && indirect_unary_predicate, Proj>>, borrowed_iterator_t> diff --git a/include/nanorange/algorithm/remove.hpp b/include/nanorange/algorithm/remove.hpp index aceb6f6..21579f4 100644 --- a/include/nanorange/algorithm/remove.hpp +++ b/include/nanorange/algorithm/remove.hpp @@ -38,7 +38,7 @@ struct remove_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && permutable && indirect_relation, const T*>, I> @@ -48,7 +48,7 @@ struct remove_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && permutable> && indirect_relation, Proj>, const T*>, diff --git a/include/nanorange/algorithm/remove_if.hpp b/include/nanorange/algorithm/remove_if.hpp index d846007..2cbb0fc 100644 --- a/include/nanorange/algorithm/remove_if.hpp +++ b/include/nanorange/algorithm/remove_if.hpp @@ -38,7 +38,7 @@ struct remove_if_fn { public: template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_iterator && sentinel_for && permutable && indirect_unary_predicate>, I> @@ -48,7 +48,7 @@ struct remove_if_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && permutable> && indirect_unary_predicate, Proj>>, borrowed_iterator_t> diff --git a/include/nanorange/algorithm/rotate.hpp b/include/nanorange/algorithm/rotate.hpp index 64b8e4d..ca5944e 100644 --- a/include/nanorange/algorithm/rotate.hpp +++ b/include/nanorange/algorithm/rotate.hpp @@ -53,14 +53,14 @@ struct rotate_fn { while (i != j) { if (i > j) { if (is_tma && j == 1) { - do_rotate_one_right(middle - i, middle); + (void)do_rotate_one_right(middle - i, middle); return {std::move(out), nano::next(first, last)}; } nano::swap_ranges(middle - i, unreachable_sentinel, middle, middle + j); i -= j; } else { if (is_tma && i == 1) { - do_rotate_one_left(middle - i, middle + j); + (void)do_rotate_one_left(middle - i, middle + j); return {std::move(out), nano::next(first, last)}; } nano::swap_ranges(middle - i, middle, middle + j - i, unreachable_sentinel); diff --git a/include/nanorange/algorithm/search_n.hpp b/include/nanorange/algorithm/search_n.hpp index eafa29c..15b23bc 100644 --- a/include/nanorange/algorithm/search_n.hpp +++ b/include/nanorange/algorithm/search_n.hpp @@ -57,7 +57,7 @@ struct search_n_fn { public: template - constexpr auto operator()(I first, S last, iter_difference_t count, + [[nodiscard]] constexpr auto operator()(I first, S last, iter_difference_t count, const T& value, Pred pred = Pred{}, Proj proj = Proj{}) const -> std::enable_if_t && sentinel_for && @@ -70,7 +70,7 @@ struct search_n_fn { template - constexpr auto + [[nodiscard]] constexpr auto operator()(Rng&& rng, iter_difference_t> count, const T& value, Pred pred = Pred{}, Proj proj = Proj{}) const -> std::enable_if_t< diff --git a/include/nanorange/algorithm/stable_partition.hpp b/include/nanorange/algorithm/stable_partition.hpp index eca8da1..077a750 100644 --- a/include/nanorange/algorithm/stable_partition.hpp +++ b/include/nanorange/algorithm/stable_partition.hpp @@ -149,7 +149,7 @@ struct stable_partition_fn { public: template - std::enable_if_t && sentinel_for && + [[nodiscard]] std::enable_if_t && sentinel_for && indirect_unary_predicate> && permutable, subrange> operator()(I first, S last, Pred pred, Proj proj = Proj{}) const @@ -159,7 +159,7 @@ struct stable_partition_fn { } template - std::enable_if_t< + [[nodiscard]] std::enable_if_t< bidirectional_range && indirect_unary_predicate, Proj>> && permutable>, diff --git a/include/nanorange/algorithm/unique.hpp b/include/nanorange/algorithm/unique.hpp index f2e4fcd..c666696 100644 --- a/include/nanorange/algorithm/unique.hpp +++ b/include/nanorange/algorithm/unique.hpp @@ -41,7 +41,7 @@ struct unique_fn { public: template - constexpr std::enable_if_t && sentinel_for && + [[nodiscard]] constexpr std::enable_if_t && sentinel_for && indirect_relation> && permutable, subrange> operator()(I first, S last, R comp = {}, Proj proj = Proj{}) const @@ -51,7 +51,7 @@ struct unique_fn { } template - constexpr std::enable_if_t< + [[nodiscard]] constexpr std::enable_if_t< forward_range && indirect_relation, Proj>> && permutable>, diff --git a/include/nanorange/algorithm/upper_bound.hpp b/include/nanorange/algorithm/upper_bound.hpp index 2dd7558..ad365d8 100644 --- a/include/nanorange/algorithm/upper_bound.hpp +++ b/include/nanorange/algorithm/upper_bound.hpp @@ -41,7 +41,7 @@ struct upper_bound_fn { public: template - std::enable_if_t< + [[nodiscard]] std::enable_if_t< forward_iterator && sentinel_for && indirect_strict_weak_order>, I> @@ -54,7 +54,7 @@ struct upper_bound_fn { template - std::enable_if_t && + [[nodiscard]] std::enable_if_t && indirect_strict_weak_order, Proj>>, borrowed_iterator_t> constexpr operator()(Rng&& rng, const T& value, Comp comp = Comp{}, diff --git a/include/nanorange/detail/algorithm/result_types.hpp b/include/nanorange/detail/algorithm/result_types.hpp index 5d8a0c7..4826e81 100644 --- a/include/nanorange/detail/algorithm/result_types.hpp +++ b/include/nanorange/detail/algorithm/result_types.hpp @@ -132,7 +132,7 @@ struct in_out_out_result { }; template -struct min_max_result { +struct [[nodiscard]] min_max_result { NANO_NO_UNIQUE_ADDRESS T min; NANO_NO_UNIQUE_ADDRESS T max; diff --git a/include/nanorange/views/all.hpp b/include/nanorange/views/all.hpp index 14b4dfe..a50b55f 100644 --- a/include/nanorange/views/all.hpp +++ b/include/nanorange/views/all.hpp @@ -43,7 +43,7 @@ struct all_view_fn { public: template - constexpr auto operator()(T&& t) const + [[nodiscard]] constexpr auto operator()(T&& t) const noexcept(noexcept(all_view_fn::impl(std::forward(t), priority_tag<2>{}))) -> decltype(all_view_fn::impl(std::forward(t), priority_tag<2>{})) { diff --git a/include/nanorange/views/common.hpp b/include/nanorange/views/common.hpp index 662fb19..b0a1d17 100644 --- a/include/nanorange/views/common.hpp +++ b/include/nanorange/views/common.hpp @@ -125,7 +125,7 @@ struct common_view_fn { public: template - constexpr auto operator()(T&& t) const + [[nodiscard]] constexpr auto operator()(T&& t) const -> std::enable_if_t< viewable_range, decltype(common_view_fn::impl(std::forward(t), diff --git a/include/nanorange/views/counted.hpp b/include/nanorange/views/counted.hpp index 352883e..bcdd9eb 100644 --- a/include/nanorange/views/counted.hpp +++ b/include/nanorange/views/counted.hpp @@ -40,7 +40,7 @@ struct counted_fn { public: template > - constexpr auto operator()(E&& e, F&& f) const + [[nodiscard]] constexpr auto operator()(E&& e, F&& f) const noexcept(noexcept(impl(std::forward(e), static_cast>(std::forward(f)), nano::detail::priority_tag<1>{}))) diff --git a/include/nanorange/views/drop.hpp b/include/nanorange/views/drop.hpp index 3a06057..e59c6cf 100644 --- a/include/nanorange/views/drop.hpp +++ b/include/nanorange/views/drop.hpp @@ -105,14 +105,14 @@ namespace detail { struct drop_view_fn { template - constexpr auto operator()(E&& e, F&& f) const + [[nodiscard]] constexpr auto operator()(E&& e, F&& f) const -> decltype(drop_view{std::forward(e), std::forward(f)}) { return drop_view{std::forward(e), std::forward(f)}; } template - constexpr auto operator()(C c) const + [[nodiscard]] constexpr auto operator()(C c) const { return detail::rao_proxy{[c = std::move(c)](auto&& r) mutable #ifndef NANO_MSVC_LAMBDA_PIPE_WORKAROUND diff --git a/include/nanorange/views/drop_while.hpp b/include/nanorange/views/drop_while.hpp index 1fd246b..5b6938b 100644 --- a/include/nanorange/views/drop_while.hpp +++ b/include/nanorange/views/drop_while.hpp @@ -66,14 +66,14 @@ namespace detail { struct drop_while_view_fn { template - constexpr auto operator()(E&& e, F&& f) const + [[nodiscard]] constexpr auto operator()(E&& e, F&& f) const -> decltype(drop_while_view{std::forward(e), std::forward(f)}) { return drop_while_view{std::forward(e), std::forward(f)}; } template - constexpr auto operator()(Pred&& pred) const + [[nodiscard]] constexpr auto operator()(Pred&& pred) const { return detail::rao_proxy{[p = std::forward(pred)](auto&& r) mutable #ifndef NANO_MSVC_LAMBDA_PIPE_WORKAROUND diff --git a/include/nanorange/views/elements.hpp b/include/nanorange/views/elements.hpp index ef5f730..53b00ca 100644 --- a/include/nanorange/views/elements.hpp +++ b/include/nanorange/views/elements.hpp @@ -311,7 +311,7 @@ namespace detail { template struct elements_view_fn { template - constexpr auto operator()(E&& e) const + [[nodiscard]] constexpr auto operator()(E&& e) const -> decltype(elements_view(e))>, N>{std::forward(e)}) { return elements_view(e))>, N>{std::forward(e)}; diff --git a/include/nanorange/views/empty.hpp b/include/nanorange/views/empty.hpp index a74d980..a68f9cd 100644 --- a/include/nanorange/views/empty.hpp +++ b/include/nanorange/views/empty.hpp @@ -14,7 +14,7 @@ NANO_BEGIN_NAMESPACE namespace empty_view_ { template -class empty_view : view_interface> { +class [[nodiscard]] empty_view : view_interface> { static_assert(std::is_object::value, ""); public: diff --git a/include/nanorange/views/filter.hpp b/include/nanorange/views/filter.hpp index 3f7e111..952b4ca 100644 --- a/include/nanorange/views/filter.hpp +++ b/include/nanorange/views/filter.hpp @@ -248,7 +248,7 @@ namespace detail { struct filter_view_fn { template - constexpr auto operator()(Pred pred) const + [[nodiscard]] constexpr auto operator()(Pred pred) const { return detail::rao_proxy{[p = std::move(pred)] (auto&& r) mutable #ifndef NANO_MSVC_LAMBDA_PIPE_WORKAROUND @@ -260,7 +260,7 @@ struct filter_view_fn { } template - constexpr auto operator()(R&& r, Pred pred) const + [[nodiscard]] constexpr auto operator()(R&& r, Pred pred) const noexcept(noexcept(filter_view{std::forward(r), std::move(pred)})) -> decltype(filter_view{std::forward(r), std::move(pred)}) { diff --git a/include/nanorange/views/iota.hpp b/include/nanorange/views/iota.hpp index 7eeaa1b..9fe8e72 100644 --- a/include/nanorange/views/iota.hpp +++ b/include/nanorange/views/iota.hpp @@ -363,7 +363,7 @@ namespace detail { struct iota_view_fn { template - constexpr auto operator()(W&& value) const + [[nodiscard]] constexpr auto operator()(W&& value) const noexcept(noexcept(iota_view{std::forward(value)})) -> decltype(iota_view(std::forward(value))) { @@ -371,7 +371,7 @@ struct iota_view_fn { } template - constexpr auto operator()(W&& value, Bound&& bound) const + [[nodiscard]] constexpr auto operator()(W&& value, Bound&& bound) const noexcept(noexcept(iota_view{std::forward(value), std::forward(bound)})) -> decltype(iota_view(std::forward(value), std::forward(bound))) { diff --git a/include/nanorange/views/istream.hpp b/include/nanorange/views/istream.hpp index 5c28fe6..70623af 100644 --- a/include/nanorange/views/istream.hpp +++ b/include/nanorange/views/istream.hpp @@ -30,7 +30,7 @@ NANO_CONCEPT StreamExtractable = } // namespace detail template > -struct basic_istream_view : view_interface> { +struct [[nodiscard]] basic_istream_view : view_interface> { static_assert(movable); static_assert(default_initializable); diff --git a/include/nanorange/views/join.hpp b/include/nanorange/views/join.hpp index 06892f2..4dd607e 100644 --- a/include/nanorange/views/join.hpp +++ b/include/nanorange/views/join.hpp @@ -353,7 +353,7 @@ namespace detail { struct join_view_fn { template - constexpr auto operator()(E&& e) const + [[nodiscard]] constexpr auto operator()(E&& e) const -> decltype(join_view{std::forward(e)}) { return join_view{std::forward(e)}; diff --git a/include/nanorange/views/ref.hpp b/include/nanorange/views/ref.hpp index 4fcf82b..568ab86 100644 --- a/include/nanorange/views/ref.hpp +++ b/include/nanorange/views/ref.hpp @@ -14,7 +14,7 @@ NANO_BEGIN_NAMESPACE namespace ref_view_ { template -class ref_view : public view_interface> { +class [[nodiscard]] ref_view : public view_interface> { static_assert(range && std::is_object::value, ""); @@ -77,4 +77,4 @@ inline constexpr bool enable_borrowed_range> = true; NANO_END_NAMESPACE -#endif \ No newline at end of file +#endif diff --git a/include/nanorange/views/reverse.hpp b/include/nanorange/views/reverse.hpp index ecc6f74..22e7a93 100644 --- a/include/nanorange/views/reverse.hpp +++ b/include/nanorange/views/reverse.hpp @@ -124,7 +124,7 @@ struct reverse_view_fn { public: template - constexpr auto operator()(R&& r) const + [[nodiscard]] constexpr auto operator()(R&& r) const -> decltype(impl(std::forward(r), priority_tag<1>{})) { return impl(std::forward(r), priority_tag<1>{}); diff --git a/include/nanorange/views/single.hpp b/include/nanorange/views/single.hpp index 1eafb4a..e1dac3d 100644 --- a/include/nanorange/views/single.hpp +++ b/include/nanorange/views/single.hpp @@ -54,7 +54,7 @@ namespace detail { struct single_view_fn { template - constexpr auto operator()(T&& t) const + [[nodiscard]] constexpr auto operator()(T&& t) const noexcept(noexcept(single_view{std::forward(t)})) -> decltype(single_view{std::forward(t)}) { @@ -71,4 +71,4 @@ NANO_INLINE_VAR(detail::single_view_fn, single) NANO_END_NAMESPACE -#endif \ No newline at end of file +#endif diff --git a/include/nanorange/views/split.hpp b/include/nanorange/views/split.hpp index f75a638..0a01e0d 100644 --- a/include/nanorange/views/split.hpp +++ b/include/nanorange/views/split.hpp @@ -425,14 +425,14 @@ namespace detail { struct split_view_fn { template - constexpr auto operator()(E&& e, F&& f) const + [[nodiscard]] constexpr auto operator()(E&& e, F&& f) const -> decltype(split_view{std::forward(e), std::forward(f)}) { return split_view{std::forward(e), std::forward(f)}; } template - constexpr auto operator()(P&& p) const + [[nodiscard]] constexpr auto operator()(P&& p) const { return detail::rao_proxy{ [p = std::forward

(p)](auto&& r) mutable diff --git a/include/nanorange/views/subrange.hpp b/include/nanorange/views/subrange.hpp index a2282a9..3f1509d 100644 --- a/include/nanorange/views/subrange.hpp +++ b/include/nanorange/views/subrange.hpp @@ -172,7 +172,7 @@ constexpr subrange_kind subrange_deduction_guide_helper() namespace subrange_ { template -class subrange : public view_interface> { +class [[nodiscard]] subrange : public view_interface> { static_assert(input_or_output_iterator); static_assert(sentinel_for); static_assert(K == subrange_kind::sized || !sized_sentinel_for, ""); diff --git a/include/nanorange/views/take.hpp b/include/nanorange/views/take.hpp index bc87d17..7d62c9b 100644 --- a/include/nanorange/views/take.hpp +++ b/include/nanorange/views/take.hpp @@ -172,7 +172,7 @@ using take_view_helper_t = take_view>; struct take_view_fn { template - constexpr auto operator()(C c) const + [[nodiscard]] constexpr auto operator()(C c) const { return detail::rao_proxy{[c = std::move(c)](auto&& r) mutable @@ -187,7 +187,7 @@ struct take_view_fn { } template - constexpr auto operator()(E&& e, F&& f) const + [[nodiscard]] constexpr auto operator()(E&& e, F&& f) const -> decltype(take_view{std::forward(e), std::forward(f)}) { return take_view{std::forward(e), std::forward(f)}; diff --git a/include/nanorange/views/take_while.hpp b/include/nanorange/views/take_while.hpp index 4034694..7864775 100644 --- a/include/nanorange/views/take_while.hpp +++ b/include/nanorange/views/take_while.hpp @@ -128,14 +128,14 @@ namespace detail { struct take_while_view_fn { template - constexpr auto operator()(E&& e, F&& f) const + [[nodiscard]] constexpr auto operator()(E&& e, F&& f) const -> decltype(take_while_view{std::forward(e), std::forward(f)}) { return take_while_view{std::forward(e), std::forward(f)}; } template - constexpr auto operator()(Pred&& pred) const + [[nodiscard]] constexpr auto operator()(Pred&& pred) const { return detail::rao_proxy{[p = std::forward(pred)](auto&& r) mutable #ifndef NANO_MSVC_LAMBDA_PIPE_WORKAROUND diff --git a/include/nanorange/views/transform.hpp b/include/nanorange/views/transform.hpp index 03d550d..366a4d4 100644 --- a/include/nanorange/views/transform.hpp +++ b/include/nanorange/views/transform.hpp @@ -360,14 +360,14 @@ namespace detail { struct transform_view_fn { template - constexpr auto operator()(E&& e, F&& f) const + [[nodiscard]] constexpr auto operator()(E&& e, F&& f) const -> decltype(transform_view{std::forward(e), std::forward(f)}) { return transform_view{std::forward(e), std::forward(f)}; } template - constexpr auto operator()(F f) const + [[nodiscard]] constexpr auto operator()(F f) const { return detail::rao_proxy{[f = std::move(f)](auto&& r) mutable #ifndef NANO_MSVC_LAMBDA_PIPE_WORKAROUND diff --git a/test/algorithm/equal_range.cpp b/test/algorithm/equal_range.cpp index 0c5868b..2a714b7 100644 --- a/test/algorithm/equal_range.cpp +++ b/test/algorithm/equal_range.cpp @@ -42,7 +42,7 @@ void not_totally_ordered() { // This better compile! std::vector vec; - ranges::equal_range(vec, my_int{10}, compare); + (void)ranges::equal_range(vec, my_int{10}, compare); } template diff --git a/test/algorithm/lower_bound.cpp b/test/algorithm/lower_bound.cpp index 670c950..d8fa278 100644 --- a/test/algorithm/lower_bound.cpp +++ b/test/algorithm/lower_bound.cpp @@ -37,7 +37,7 @@ void not_totally_ordered() { // This better compile! std::vector vec; - stl2::lower_bound(vec, my_int{10}, compare); + (void)stl2::lower_bound(vec, my_int{10}, compare); } } diff --git a/test/algorithm/upper_bound.cpp b/test/algorithm/upper_bound.cpp index 768a3d4..b3cb8e6 100644 --- a/test/algorithm/upper_bound.cpp +++ b/test/algorithm/upper_bound.cpp @@ -36,7 +36,7 @@ void not_totally_ordered() { // This better compile! std::vector vec; - stl2::upper_bound(vec, my_int{10}, compare); + (void)stl2::upper_bound(vec, my_int{10}, compare); } } diff --git a/test/basic_algorithm/modifying_seq_ops.cpp b/test/basic_algorithm/modifying_seq_ops.cpp index 51fb153..2d38722 100644 --- a/test/basic_algorithm/modifying_seq_ops.cpp +++ b/test/basic_algorithm/modifying_seq_ops.cpp @@ -508,13 +508,13 @@ TEST_CASE("alg.basic.rotate") SECTION("with iterators") { const std::vector result{2, 3, 4, 5, 1}; - rng::rotate(vec.begin(), vec.begin() + 1, vec.end()); + (void)rng::rotate(vec.begin(), vec.begin() + 1, vec.end()); REQUIRE(vec == result); } SECTION("with range") { const std::vector result{2, 3, 4, 5, 1}; - rng::rotate(vec, vec.begin() + 1); + (void)rng::rotate(vec, vec.begin() + 1); REQUIRE(vec == result); } } diff --git a/test/basic_algorithm/partitioning_ops.cpp b/test/basic_algorithm/partitioning_ops.cpp index 4cebe61..3a003ea 100644 --- a/test/basic_algorithm/partitioning_ops.cpp +++ b/test/basic_algorithm/partitioning_ops.cpp @@ -32,11 +32,11 @@ TEST_CASE("alg.basic.partition") const auto is_even = [](int i) { return i % 2 == 0; }; SECTION("with iterators") { - rng::partition(vec.begin(), vec.end(), is_even); + (void)rng::partition(vec.begin(), vec.end(), is_even); } SECTION("witn range") { - rng::partition(vec, is_even); + (void)rng::partition(vec, is_even); } REQUIRE(std::is_partitioned(vec.begin(), vec.end(), is_even)); @@ -77,11 +77,11 @@ TEST_CASE("alg.basic.stable_partition") }(); SECTION("with iterators") { - rng::stable_partition(src.begin(), src.end(), is_even); + (void)rng::stable_partition(src.begin(), src.end(), is_even); } SECTION("with range") { - rng::stable_partition(src, is_even); + (void)rng::stable_partition(src, is_even); } REQUIRE(src == test); diff --git a/test/views/filter_view.cpp b/test/views/filter_view.cpp index 6f236ce..14ba726 100644 --- a/test/views/filter_view.cpp +++ b/test/views/filter_view.cpp @@ -140,7 +140,7 @@ TEST_CASE("views.filter") { auto yes = [](int) { return true; }; auto const rng = views::iota(0) | views::filter(yes); - views::all(rng); + (void)views::all(rng); } {