Title
`ranges` namespace is used inconsistently in [algorithms]
Status
new
Section
[algorithms]
Submitter
Ruslan Arutyunyan

Created on 2025-12-12.00:00:00 last changed 2 months ago

Messages

Date: 2025-12-12.00:00:00

`ranges` namespace is used inconsistently in [algorithms]. One example is:

template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  requires sortable<iterator_t<R>, Comp, Proj>
  constexpr borrowed_iterator_t<R>
    ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {});

where we can see `ranges::` before `push_heap` name itself, also before `less` but not before `random_access_range`. It's all over the place. The same is with `sort`:

template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  requires sortable<iterator_t<R>, Comp, Proj>
  constexpr borrowed_iterator_t<R>
    ranges::sort(R&& r, Comp comp = {}, Proj proj = {});

Another example is `for_each` where we don't have `ranges` namespace before `borrowed_iterator_t`:

template<input_range R, class Proj = identity,
         indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
  constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
    ranges::for_each(R&& r, Fun f, Proj proj = {});

There is no clear resolution for that, but during an LWG session is was decided to create an LWG issue for this.

History
Date User Action Args
2025-12-12 00:00:00admincreate