removed redundant helper::advanced (equal to std::next(iter, n))

This commit is contained in:
Patrick 2024-01-27 19:40:30 +01:00
parent ad406e9647
commit c328859e2d
1 changed files with 2 additions and 4 deletions

View File

@ -6,12 +6,10 @@
#define CONST_CONTAINER_HELPER_H_
#include <cstddef>
#include <iterator>
namespace cc::helper {
template <std::input_or_output_iterator Iter, typename Distance>
inline auto advanced(Iter i, Distance n) { std::advance(i, n); return i; }
template<typename T, std::size_t N>
constexpr std::size_t array_size(const T(&)[N]) { return N; }
@ -31,7 +29,7 @@ namespace cc::helper {
auto swap_dist = std::min(dist1, dist2);
std::swap_ranges(first1, advanced(first1, swap_dist), first2, advanced(first2, swap_dist));
std::swap_ranges(first1, std::next(first1, swap_dist), first2, std::next(first2, swap_dist));
std::advance(first1, swap_dist);
std::advance(first2, swap_dist);