[libcxx-commits] [PATCH] D118400: [libc++] Remove operator-> from iterator archetypes that don't need it

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 10 09:26:16 PST 2022


Quuxplusone accepted this revision as: Quuxplusone.
Quuxplusone added a comment.

LGTM % the `check` lambda stuff (which I won't insist on, anyway). Thanks!



================
Comment at: libcxx/test/std/iterators/predef.iterators/iterators.common/arrow.pass.cpp:24-26
   // Case 1: http://eel.is/c++draft/iterators.common#common.iter.access-5.1
   {
+    auto check = []<class Iterator>() {
----------------
Nit: Why not good old-fashioned
```
template<class It>
void test_case_1() {
    // Case 1: http://eel.is/c++draft/iterators.common#common.iter.access-5.1
    ~~~
}

template<class It>
void test_case_2() {
```
etc? The whole `check.operator()<T>();` thing //works//, but it doesn't //look nice//.


================
Comment at: libcxx/test/std/iterators/predef.iterators/iterators.common/iterator_traits.compile.pass.cpp:94
     static_assert(std::same_as<IterTraits::difference_type, std::ptrdiff_t>);
-    static_assert(std::same_as<IterTraits::pointer, const Iter&>);
+    static_assert(std::same_as<IterTraits::pointer, int*>);
     static_assert(std::same_as<IterTraits::reference, int&>);
----------------
Quuxplusone wrote:
> The code on the left strikes me as weird. But whatever, I'm getting deja vu to a conversation with @CaseyCarter where he said nobody cares about the value of `::pointer`. :)
For my information, did we ever figure out why the old code thought it'd be `const Iter&`?
("No" is an acceptable answer. ;))


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118400/new/

https://reviews.llvm.org/D118400



More information about the libcxx-commits mailing list