Make the helper routines in string really be constexpr. This required a bit of refacoring in algorithm as well. Give them better names while we're at it. All of these are internal rotines; no visible functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210561 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2014-06-10 18:51:55 +00:00
parent c1345e3262
commit 37025e1b32
2 changed files with 60 additions and 48 deletions

View File

@@ -975,7 +975,7 @@ __find_end(_BidirectionalIterator1 __first1, _BidirectionalIterator1 __last1,
}
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
_RandomAccessIterator1
_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1
__find_end(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
random_access_iterator_tag, random_access_iterator_tag)
@@ -1041,8 +1041,8 @@ find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
// find_first_of
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
_ForwardIterator1
find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_LIBCPP_CONSTEXPR_AFTER_CXX11 _ForwardIterator1
__find_first_of_ce(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
{
for (; __first1 != __last1; ++__first1)
@@ -1052,6 +1052,16 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
return __last1;
}
template <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator1
find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __pred)
{
return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __pred);
}
template <class _ForwardIterator1, class _ForwardIterator2>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator1
@@ -1060,7 +1070,7 @@ find_first_of(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
{
typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
return _VSTD::find_first_of(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
return _VSTD::__find_first_of_ce(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
}
// adjacent_find
@@ -1440,7 +1450,7 @@ __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
}
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
_RandomAccessIterator1
_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator1
__search(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
random_access_iterator_tag, random_access_iterator_tag)