diff --git a/c++/itertools/iterator_facade.hpp b/c++/itertools/iterator_facade.hpp index 371ba63..acc894a 100644 --- a/c++/itertools/iterator_facade.hpp +++ b/c++/itertools/iterator_facade.hpp @@ -60,10 +60,10 @@ namespace itertools { template struct iterator_facade { private: - /// Get a reference to the derived iterator. + // Get a reference to the derived iterator. [[nodiscard]] Iter &self() { return static_cast(*this); } - /// Get a const reference to the derived iterator. + // Get a const reference to the derived iterator. [[nodiscard]] Iter const &self() const { return static_cast(*this); } public: diff --git a/c++/itertools/product.hpp b/c++/itertools/product.hpp index f764252..ef9e9c6 100644 --- a/c++/itertools/product.hpp +++ b/c++/itertools/product.hpp @@ -87,10 +87,7 @@ namespace itertools { prod_iter(std::tuple its_begin, EndIters its_end) : its_begin(std::move(its_begin)), its_end(std::move(its_end)) {} private: - /** - * @brief Helper function which recursively increments the current iterators. - * @tparam N Iterator index to increment. - */ + // Helper function to recursively increment the current iterators. template void _increment() { // increment Nth iterator ++std::get(its); @@ -128,10 +125,7 @@ namespace itertools { template [[nodiscard]] bool operator==(sentinel_t const &s) const { return (s.it == std::get<0>(its)); } private: - /** - * @brief Helper function to dereference all original iterators. - * @return Tuple containing the dereferenced values of all original iterators. - */ + // Helper function to dereference all original iterators. template [[gnu::always_inline]] [[nodiscard]] auto tuple_map_impl(std::index_sequence) const { return std::tuple(its))...>(*std::get(its)...); } @@ -174,12 +168,12 @@ namespace itertools { [[nodiscard]] bool operator==(multiplied const &) const = default; private: - /// Helper function to create a detail::prod_iter representing the beginning of the product range. + // Helper function to create a detail::prod_iter representing the beginning of the product range. template [[gnu::always_inline]] auto _begin(std::index_sequence) { return iterator{std::make_tuple(std::begin(std::get(tu))...), std::make_tuple(std::end(std::get(tu))...)}; } - /// Const version of _begin(std::index_sequence). + // Const version of _begin(std::index_sequence). template [[gnu::always_inline]] auto _cbegin(std::index_sequence) const { return const_iterator{std::make_tuple(std::cbegin(std::get(tu))...), std::make_tuple(std::cend(std::get(tu))...)}; } @@ -214,13 +208,7 @@ namespace itertools { // Class template argument deduction guide. template multiplied(Rs &&...) -> multiplied...>; - /** - * @brief Helper function to create a product range from a container of ranges. - * - * @tparam C Container type. - * @param cont Container of ranges. - * @return Product range from the ranges in the container. - */ + // Helper function to create a product range from a container of ranges. template [[gnu::always_inline]] [[nodiscard]] auto make_product_impl(C &cont, std::index_sequence) { return product(cont[Is]...); } diff --git a/c++/itertools/range.hpp b/c++/itertools/range.hpp index 6db3bb5..d3ad4f4 100644 --- a/c++/itertools/range.hpp +++ b/c++/itertools/range.hpp @@ -77,13 +77,13 @@ namespace itertools { * See also std::ranges::views::iota. */ class range { - /// First value of the range. + // First value of the range. long first_ = 0; - /// Last value of the range (excluded). + // Last value of the range (excluded). long last_ = -1; - /// Number of integers between two elements of the range. + // Number of integers between two elements of the range. long step_ = 1; public: @@ -258,19 +258,19 @@ namespace itertools { * @brief Beginning of the integer range. * @return Iterator with its current value set to the first value of the range. */ - [[nodiscard]] const_iterator begin() const noexcept { return {first_, last_, step_}; } - - /// Const version of begin(). [[nodiscard]] const_iterator cbegin() const noexcept { return {first_, last_, step_}; } + /// The same as cbegin(). + [[nodiscard]] const_iterator begin() const noexcept { return {first_, last_, step_}; } + /** * @brief End of the range. * @return Iterator with its current value set to the excluded last value of the range. */ - [[nodiscard]] const_iterator end() const noexcept { return {last_, last_, step_}; } - - /// Const version of end(). [[nodiscard]] const_iterator cend() const noexcept { return {last_, last_, step_}; } + + /// The same as cend(). + [[nodiscard]] const_iterator end() const noexcept { return {last_, last_, step_}; } }; /** @@ -307,13 +307,7 @@ namespace itertools { /// @cond namespace detail { - /** - * @brief Helper function to create a product range of integer ranges from a tuple or an array. - * - * @tparam T Tuple or array type. - * @param idxs Tuple or array containing the excluded last values of the itertools::range objects. - * @return Product (detail::multiplied) range of integer ranges. - */ + // Helper function to create a product range of integer ranges from a tuple or an array. template [[gnu::always_inline]] auto product_range_impl(T const &idxs, std::index_sequence) { return product_range(std::get(idxs)...); } diff --git a/c++/itertools/stride.hpp b/c++/itertools/stride.hpp index fecb2cd..aacfbd4 100644 --- a/c++/itertools/stride.hpp +++ b/c++/itertools/stride.hpp @@ -108,10 +108,7 @@ namespace itertools { [[nodiscard]] bool operator==(strided const &) const = default; private: - /** - * @brief Helper function to calculate the index of the end iterator. - * @return Index of the end iterator. - */ + // Helper function to calculate the index of the end iterator. [[nodiscard]] std::ptrdiff_t end_offset() const { auto size = distance(std::cbegin(rg), std::cend(rg)); return (size == 0) ? 0 : ((size - 1) / stride + 1) * stride; diff --git a/c++/itertools/zip.hpp b/c++/itertools/zip.hpp index b288a92..45ec6ba 100644 --- a/c++/itertools/zip.hpp +++ b/c++/itertools/zip.hpp @@ -60,7 +60,7 @@ namespace itertools { zip_iter(std::tuple its) : its(std::move(its)) {} private: - /// Helper function which increments all original iterators. + // Helper function which increments all original iterators. template [[gnu::always_inline]] void increment_all(std::index_sequence) { ((void)(++std::get(its)), ...); } public: @@ -92,10 +92,7 @@ namespace itertools { } private: - /** - * @brief Helper function to dereference all original iterators. - * @return Tuple containing the dereferenced values of all original iterators. - */ + // Helper function to dereference all original iterators. template [[nodiscard]] auto tuple_map_impl(std::index_sequence) const { return std::tuple(its))...>(*std::get(its)...); } @@ -141,19 +138,12 @@ namespace itertools { [[nodiscard]] bool operator==(zipped const &) const = default; private: - /** - * @brief Helper function that applies a given callable to each range in the stored tuple and returns a - * new tuple with the results. - * - * @tparam F Callable type. - * @param f Callable object. - * @return Tuple containing the mapped tuple elements after applying the callable. - */ + // Helper function that applies a given callable to each range in the stored tuple and returns a new tuple with the results. template [[gnu::always_inline]] auto tuple_map(F &&f, std::index_sequence) { return std::make_tuple(std::forward(f)(std::get(tu))...); } - /// Const overload of tuple_map(F &&, std::index_sequence). + // Const overload of tuple_map(F &&, std::index_sequence). template [[gnu::always_inline]] auto tuple_map(F &&f, std::index_sequence) const { return std::make_tuple(std::forward(f)(std::get(tu))...); }