[libcxx-commits] [PATCH] D142335: [libc++][ranges] Implement `ranges::to`.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 3 09:36:41 PDT 2023


var-const marked an inline comment as done.
var-const added inline comments.


================
Comment at: libcxx/include/__ranges/from_range.h:24
+struct from_range_t {
+  _LIBCPP_HIDE_FROM_ABI explicit from_range_t() = default;
+};
----------------
philnik wrote:
> I think with the current HIDE_FROM_ABI rules this shouldn't be marked.
Can you elaborate?


================
Comment at: libcxx/include/__ranges/to.h:127
+    } else {
+      static_assert(__always_false<_Container>, "ranges::to: unable to convert to the given container type.");
+    }
----------------
philnik wrote:
> Is this the only use for `__always_false`? If yes, good news: `static_assert(false)` gets accepted by clang 17 and GCC 13, so this can soon just be what it was always supposed to be.
This is the only use that I could find (although I'm a little skeptical -- perhaps this is done in a more ad-hoc way somewhere). And yes, I can't wait to be able to use `static_assert(false)`.


================
Comment at: libcxx/include/__ranges/to.h:240
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr auto to(_Args&&... __args) {
+  return __range_adaptor_closure_t(std::__bind_back(__to_deduced<_Container>(), std::forward<_Args>(__args)...));
+}
----------------
philnik wrote:
> 
We don't implement `bind_back` officially yet, but the internal version is used in the implementation of ranges (and was added for that purpose).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142335



More information about the libcxx-commits mailing list