[libcxx-commits] [PATCH] D102121: [libcxx][ranges] adds _`non-propagating-cache`_

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 20 12:31:20 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/__ranges/non_propagating_cache.h:42
+  // may refer to internal details of the source view.
+  template<class _Tp>
+  class __non_propagating_cache {
----------------
Mordante wrote:
> http://eel.is/c++draft/range.nonprop.cache#1.1 `non-propagating-cache<T> constrains its type parameter T with is_­object_­v<T>.`
This is undetectable, and therefore it's cheaper (in terms of compile time and source code simplicity) not to bother with it.


================
Comment at: libcxx/include/__ranges/non_propagating_cache.h:87
+    constexpr void __set(_Tp&& __value) { __value_.emplace(_VSTD::move(__value)); }
+  };
+
----------------
Mordante wrote:
> I miss http://eel.is/c++draft/range.nonprop.cache#1.6
> ```
> non-propagating-cache<T> has an additional member function template specified as follows:
> 
> template<class I>
>   constexpr T& emplace-deref(const I& i);    // exposition only
> 
> ```
> Is that intentionally?
Exposition-only members are undetectable, and anyway it looks like //`emplace-deref`// is equivalent to `this->emplace(*i)`.
See tcanens' comment https://reviews.llvm.org/D102121#inline-965635


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102121



More information about the libcxx-commits mailing list