diff --git a/ostd/algorithm.hh b/ostd/algorithm.hh index 63037d4..2756a87 100644 --- a/ostd/algorithm.hh +++ b/ostd/algorithm.hh @@ -732,6 +732,11 @@ inline R1 find_one_of(R1 range, R2 values) { } return range; } + +/** @brief A pipeable version of ostd::find_one_of(). + * + * The `values` range is forwarded. + */ template inline auto find_one_of(R &&values) { return [values = std::forward(values)](auto &obj) mutable { diff --git a/ostd/range.hh b/ostd/range.hh index 673554d..fba779c 100644 --- a/ostd/range.hh +++ b/ostd/range.hh @@ -100,7 +100,7 @@ struct output_range_tag {}; * * You can learn more about the characteristics [here](@ref ranges). * - * @see ostd::input_range_tag, ostd::bidirectional_rnage_tag + * @see ostd::input_range_tag, ostd::bidirectional_range_tag */ struct forward_range_tag: input_range_tag {}; @@ -113,7 +113,7 @@ struct forward_range_tag: input_range_tag {}; * * You can learn more about the characteristics [here](@ref ranges). * - * @see ostd::forward_rnage_tag, ostd::random_access_range_tag + * @see ostd::forward_range_tag, ostd::random_access_range_tag */ struct bidirectional_range_tag: forward_range_tag {}; @@ -883,12 +883,6 @@ inline auto noop_sink() { return detail::noop_output_range{}; } -/** @brief A wrapper range that counts the elements put in the range. - * - * Takes any output range and increments a counter each time a value is - * put into it. This is useful if you need to check how many elements - * were actaully written into an output range from the inside of a call. - */ namespace detail { template struct counting_output_range: output_range> { @@ -904,22 +898,18 @@ namespace detail { public: counting_output_range() = delete; - /** @brief Constructs the range from an existing range. */ counting_output_range(R const &range): p_range(range) {} - /** @brief Copies a value into the wrapped range and increments. */ void put(value_type const &v) { p_range.put(v); ++p_written; } - /** @brief Moves a vallue into the wrapped range and increments. */ void put(value_type &&v) { p_range.put(std::move(v)); ++p_written; } - /** @brief Gets the number of written values. */ size_type get_written() const { return p_written; }