[all-commits] [llvm/llvm-project] 6ce732: [libc++] [ranges] Add namespace __cpo to ranges::{...

Quuxplusone via All-commits all-commits at lists.llvm.org
Sat Jan 8 09:48:52 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6ce732cbadf7b474da1108dc7b3b473b80944aa5
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2022-01-08 (Sat, 08 Jan 2022)

  Changed paths:
    M libcxx/include/__iterator/advance.h
    M libcxx/include/__iterator/next.h
    M libcxx/include/__iterator/prev.h

  Log Message:
  [libc++] [ranges] Add namespace __cpo to ranges::{advance,next,prev}.

The reason for those nested namespaces is explained in D115315:

> AIUI, this keeps the CPO's own type from ADL'ing into the `std::ranges`
> namespace; e.g. `foobar(std::ranges::uninitialized_default_construct)`
> should not consider `std::ranges::foobar` a candidate, even if
> `std::ranges::foobar` is not a CPO itself. Also, of course, consistency
> (Chesterton's Fence, the economist's hundred-dollar bill): if it were
> safe to omit the namespace, we'd certainly want to do it everywhere,
> not just here.

This makes these three niebloids more consistent with the other Ranges
niebloids we've already implemented, such as the `ranges::begin` group
and the `ranges::uninitialized_default_construct` group.

FWIW, we still have three different indentation-and-comment styles
among these three groups.

Differential Revision: https://reviews.llvm.org/D116569

More information about the All-commits mailing list