[libcxx-commits] [PATCH] D112665: [libc++] Ensure valid view for view_interface template parameter

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 28 12:12:27 PDT 2021


jloser updated this revision to Diff 383114.
jloser added a comment.

Remove the concept yet again in favor of inlining, except we check for completeness now still


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112665

Files:
  libcxx/include/__ranges/view_interface.h


Index: libcxx/include/__ranges/view_interface.h
===================================================================
--- libcxx/include/__ranges/view_interface.h
+++ libcxx/include/__ranges/view_interface.h
@@ -43,11 +43,13 @@
 class view_interface : public view_base {
   _LIBCPP_HIDE_FROM_ABI
   constexpr _Derived& __derived() noexcept {
+    static_assert(requires { sizeof(_Derived); } && derived_from<_Derived, view_interface<_Derived>> && view<_Derived>, "The derived type must model derived_from<view_interface<D>> and view");
     return static_cast<_Derived&>(*this);
   }
 
   _LIBCPP_HIDE_FROM_ABI
   constexpr _Derived const& __derived() const noexcept {
+    static_assert(requires { sizeof(_Derived); } && derived_from<_Derived, view_interface<_Derived>> && view<_Derived>, "The derived type must model derived_from<view_interface<D>> and view");
     return static_cast<_Derived const&>(*this);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112665.383114.patch
Type: text/x-patch
Size: 917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211028/08abe37f/attachment.bin>


More information about the libcxx-commits mailing list