mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix for VC++11
This commit is contained in:
parent
d5c61e65ca
commit
f673db1451
18 changed files with 382 additions and 164 deletions
|
@ -4,15 +4,49 @@
|
|||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace detail {
|
||||
template<typename RandomAccessIterator, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<RandomAccessIterator>::difference_type
|
||||
overlap_count_impl_ra(
|
||||
RandomAccessIterator first, RandomAccessIterator last, BinaryPredicate pred,
|
||||
typename std::iterator_traits<RandomAccessIterator>::difference_type pivot
|
||||
)
|
||||
{
|
||||
return pivot == 0 ? (pred(*first, *last) ? 1 : 0)
|
||||
: sprout::detail::overlap_count_impl_ra(
|
||||
first, sprout::next(first, pivot), pred,
|
||||
pivot / 2
|
||||
)
|
||||
+ sprout::detail::overlap_count_impl_ra(
|
||||
sprout::next(first, pivot), last, pred,
|
||||
(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) - pivot) / 2
|
||||
)
|
||||
;
|
||||
}
|
||||
template<typename RandomAccessIterator, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<RandomAccessIterator>::difference_type
|
||||
overlap_count(
|
||||
RandomAccessIterator first, RandomAccessIterator last, BinaryPredicate pred,
|
||||
std::random_access_iterator_tag*
|
||||
)
|
||||
{
|
||||
return first == last || NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) == 1 ? 0
|
||||
: sprout::detail::overlap_count_impl_ra(
|
||||
first, sprout::next(first, NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) - 1), pred,
|
||||
(NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) - 1) / 2
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
overlap_count_impl(
|
||||
InputIterator first, InputIterator last,
|
||||
BinaryPredicate pred, typename std::iterator_traits<InputIterator>::value_type const& value
|
||||
InputIterator first, InputIterator last, BinaryPredicate pred,
|
||||
typename std::iterator_traits<InputIterator>::value_type const& value
|
||||
)
|
||||
{
|
||||
return first == last ? 0
|
||||
|
@ -20,6 +54,17 @@ namespace sprout {
|
|||
: sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first)
|
||||
;
|
||||
}
|
||||
template<typename InputIterator, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
overlap_count_impl(
|
||||
InputIterator first, InputIterator last, BinaryPredicate pred,
|
||||
void*
|
||||
)
|
||||
{
|
||||
return first == last ? 0
|
||||
: sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first)
|
||||
;
|
||||
}
|
||||
|
||||
//
|
||||
// overlap_count
|
||||
|
@ -27,9 +72,8 @@ namespace sprout {
|
|||
template<typename InputIterator, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
overlap_count(InputIterator first, InputIterator last, BinaryPredicate pred) {
|
||||
return first == last ? 0
|
||||
: sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first)
|
||||
;
|
||||
typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
|
||||
return sprout::detail::overlap_count(first, last, pred, category());
|
||||
}
|
||||
|
||||
template<typename InputIterator>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue