Jelajahi Sumber

Add a specialization for '__unwrap_iter' to handle const interators. This enables the 'memmove' optimization for std::copy, etc.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@353311 91177308-0d34-0410-b5e6-96231b3b80d8
Marshall Clow 6 tahun lalu
induk
melakukan
4f9dc4d9cf
1 mengubah file dengan 12 tambahan dan 0 penghapusan
  1. 12 0
      include/algorithm

+ 12 - 0
include/algorithm

@@ -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>