mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-07-02 14:04:09 +00:00
fix next, prev
This commit is contained in:
parent
75228465fe
commit
cf9f6670b6
18 changed files with 243 additions and 0 deletions
|
@ -76,6 +76,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.8 Adjacent find
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename ForwardIterator, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator
|
||||
adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred) {
|
||||
|
|
|
@ -58,6 +58,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.1 All of
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
all_of(InputIterator first, InputIterator last, Predicate pred) {
|
||||
|
|
|
@ -58,6 +58,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.2 Any of
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
any_of(InputIterator first, InputIterator last, Predicate pred) {
|
||||
|
|
|
@ -58,6 +58,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.9 Count
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator, typename T>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count(InputIterator first, InputIterator last, T const& value) {
|
||||
|
|
|
@ -58,6 +58,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.9 Count
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count_if(InputIterator first, InputIterator last, Predicate pred) {
|
||||
|
|
|
@ -62,6 +62,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.11 Equal
|
||||
//
|
||||
// recursion depth:
|
||||
// [first1, last1), first2 are RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred) {
|
||||
|
|
|
@ -60,6 +60,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.5 Find
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator, typename T>
|
||||
inline SPROUT_CONSTEXPR InputIterator
|
||||
find(InputIterator first, InputIterator last, T const& value) {
|
||||
|
|
|
@ -77,6 +77,13 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.7 Find first
|
||||
//
|
||||
// recursion depth:
|
||||
// [first1, last1) is RandomAccessIterator -> O(log N1)
|
||||
// otherwise -> O(N1)
|
||||
// [first2, last2) is RandomAccessIterator -> O(log N2)
|
||||
// otherwise -> O(N2)
|
||||
//
|
||||
template<typename InputIterator1, typename ForwardIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR InputIterator1
|
||||
find_first_of(
|
||||
|
|
|
@ -60,6 +60,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.5 Find
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR InputIterator
|
||||
find_if(InputIterator first, InputIterator last, Predicate pred) {
|
||||
|
|
|
@ -60,6 +60,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.5 Find
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR InputIterator
|
||||
find_if_not(InputIterator first, InputIterator last, Predicate pred) {
|
||||
|
|
|
@ -76,6 +76,11 @@ namespace sprout {
|
|||
} // namespace detail
|
||||
|
||||
// 25.2.12 Is permutation
|
||||
//
|
||||
// recursion depth:
|
||||
// [first1, last1), first2 are RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N^2)
|
||||
//
|
||||
template<typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate pred) {
|
||||
|
|
|
@ -77,6 +77,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.10 Mismatch
|
||||
//
|
||||
// recursion depth:
|
||||
// [first1, last1), first2 are RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred) {
|
||||
|
|
|
@ -56,6 +56,11 @@ namespace sprout {
|
|||
} //namespace detail
|
||||
|
||||
// 25.2.3 None of
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template <typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
none_of(InputIterator first, InputIterator last, Predicate pred) {
|
||||
|
|
|
@ -19,6 +19,10 @@ namespace sprout {
|
|||
//
|
||||
// one_of
|
||||
//
|
||||
// recursion depth:
|
||||
// [first, last) is RandomAccessIterator -> O(log N)
|
||||
// otherwise -> O(N)
|
||||
//
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
one_of(InputIterator first, InputIterator last, Predicate pred) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue