[libcxx-commits] [PATCH] D101737: [libcxx] Implement view.interface.

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 3 12:48:07 PDT 2021


cjdb added inline comments.


================
Comment at: libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp:48-51
+// So that we conform to sized_sentinel_for.
+constexpr std::ptrdiff_t operator-(const ForwardIter& x, const ForwardIter& y) {
+    return x.base() - y.base();
+}
----------------
zoecarver wrote:
> cjdb wrote:
> > Nit: consider making this a hidden friend.
> Am I able to define a hidden friend out of line? I don't want to update `forward_iterator` (unless we agree that would be a good idea). 
Oh, I see, it's not for the above type. My mistake.


================
Comment at: libcxx/test/std/ranges/range.utility/view.interface/view.interface.pass.cpp:155
+
+// TODO: why is the child member picked?
+//   assert(ranges::data(din) == nullptr);
----------------
zoecarver wrote:
> cjdb wrote:
> > I think `view_interface::data` (the real one) is a function template, so it'll prefer the existing member function. @tcanens how far from the mark am I?
> That would make sense, except that it's //the child// that's getting called, i.e,  `view_interface::data`. Regardless of which one is a template, I thought it would always go for the parent's definition. 
BTW, the same is [[ https://godbolt.org/z/vGa9P6e8x | true for SFINAE ]].


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101737



More information about the libcxx-commits mailing list