[libcxx-commits] [libcxx] [libc++] optimization on ranges::drop_view::begin (#72883) (PR #72929)
    via libcxx-commits 
    libcxx-commits at lists.llvm.org
       
    Tue Nov 21 11:49:25 PST 2023
    
    
  
================
@@ -90,6 +90,10 @@ namespace ranges {
       requires (!(__simple_view<_View> &&
                   random_access_range<const _View> && sized_range<const _View>))
     {
+      if constexpr (random_access_range<const _View> && sized_range<const _View>) {
----------------
huixie90 wrote:
This overload is non-const, so you should check the non-const _View
note that the requires clause uses const for a completely different reason: the spec tries to remove this non-const instantiation if non-const and const overload are exactly the same (we (sg9) always assume that  if the type of begin and begin const are the same , they are exactly the same). So the requires clause checks const to match the const overload. 
Here you are simply using the non-const base view so the check should be on non const View
https://github.com/llvm/llvm-project/pull/72929
    
    
More information about the libcxx-commits
mailing list