[libcxx-commits] [libcxx] r353311 - Add a specialization for '__unwrap_iter' to handle const interators. This enables the 'memmove' optimization for std::copy, etc.

Marshall Clow via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 6 08:10:25 PST 2019


Author: marshall
Date: Wed Feb  6 08:10:25 2019
New Revision: 353311

URL: http://llvm.org/viewvc/llvm-project?rev=353311&view=rev
Log:
Add a specialization for '__unwrap_iter' to handle const interators. This enables the 'memmove' optimization for std::copy, etc.

Modified:
    libcxx/trunk/include/algorithm

Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=353311&r1=353310&r2=353311&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Wed Feb  6 08:10:25 2019
@@ -1610,6 +1610,18 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
     return __i.base();
 }
 
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
+typename enable_if
+<
+    is_trivially_copy_assignable<_Tp>::value,
+    const _Tp*
+>::type
+__unwrap_iter(__wrap_iter<const _Tp*> __i)
+{
+    return __i.base();
+}
+
 #else
 
 template <class _Tp>




More information about the libcxx-commits mailing list