On 09.05.2013, at 23:14, Marshall Clow wrote: > Author: marshall > Date: Thu May 9 16:14:23 2013 > New Revision: 181548 > > URL: http://llvm.org/viewvc/llvm-project?rev=181548&view=rev > Log: > Implement n3607: 'equal', 'mismatch', and 'is_permutation' > > > template<class _ForwardIterator1, class _ForwardIterator2, class > _BinaryPredicate> > @@ -1169,6 +1282,100 @@ is_permutation(_ForwardIterator1 __first > return _VSTD::is_permutation(__first1, __last1, __first2, > __equal_to<__v1, __v2>()); > } > > +#if _LIBCPP_STD_VER > 11 > +template<class _BinaryPredicate, class _ForwardIterator1, class > _ForwardIterator2> > +bool > +__is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, > + _ForwardIterator2 __first2, _ForwardIterator2 __last2, > + _BinaryPredicate __pred, > + forward_iterator_tag, forward_iterator_tag ) > +{ > + // shorten sequences as much as possible by lopping of any equal parts > + for (; __first1 != __last1 && __first2 != __last2; ++__first1, > ++__first2) > + if (!__pred(*__first1, *__first2)) > + goto __not_done; > + return __first1 == __last1 && __first2 == __last2; > +__not_done: > + // __first1 != __last1 && __first2 != __last2 && *__first1 != *__first2 > + typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1; > + _D1 __l1 = _VSTD::distance(__first1, __last1); > + > + typedef typename iterator_traits<_ForwardIterator2>::difference_type _D2; > + _D1 __l2 = _VSTD::distance(__first2, __last2);
_D2? _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
