mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-12 14:54:10 +00:00
fix recursion depth O(logN): some algorithms
This commit is contained in:
parent
28697ee7a8
commit
5019f6aa96
162 changed files with 3600 additions and 1659 deletions
|
@ -4,7 +4,6 @@
|
|||
#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 {
|
||||
|
@ -21,9 +20,9 @@ namespace sprout {
|
|||
upper_bound(ForwardIterator first, ForwardIterator last, T const& value, Compare comp) {
|
||||
return first == last ? last
|
||||
: sprout::next(first) == last ? !comp(value, *first) ? last : first
|
||||
: !comp(value, *sprout::next(first, NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2))
|
||||
? sprout::upper_bound(sprout::next(first, NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2), last, value, comp)
|
||||
: sprout::upper_bound(first, sprout::next(first, NS_SSCRISK_CEL_OR_SPROUT::distance(first, last) / 2), value, comp)
|
||||
: !comp(value, *sprout::next(first, sprout::distance(first, last) / 2))
|
||||
? sprout::upper_bound(sprout::next(first, sprout::distance(first, last) / 2), last, value, comp)
|
||||
: sprout::upper_bound(first, sprout::next(first, sprout::distance(first, last) / 2), value, comp)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue