summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2019-02-06 16:10:25 +0000
committerMarshall Clow <mclow.lists@gmail.com>2019-02-06 16:10:25 +0000
commit4f9dc4d9cfbede47cd4cba9e280b2768cb478a9f (patch)
tree8d36aecdc961871f9e24cb2013aa7bdccbc51e4f
parent5569a5e69c48d28f59bd0b5d57b84a5586ec3bbb (diff)
downloadlibcxx-4f9dc4d9cfbede47cd4cba9e280b2768cb478a9f.tar.gz
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
-rw-r--r--include/algorithm12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/algorithm b/include/algorithm
index b52d44522..7da753a49 100644
--- a/include/algorithm
+++ b/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>