mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2024-11-12 21:09:01 +00:00
Merge pull request #34 from kariya-mitsuru/binary_search
[algorithm.binary_search] Use comp parameter for lower_bound.
This commit is contained in:
commit
35cc00ff8b
1 changed files with 3 additions and 6 deletions
|
@ -11,7 +11,7 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <sprout/config.hpp>
|
#include <sprout/config.hpp>
|
||||||
#include <sprout/algorithm/lower_bound.hpp>
|
#include <sprout/algorithm/lower_bound.hpp>
|
||||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
|
#include <sprout/functional/less.hpp>
|
||||||
|
|
||||||
namespace sprout {
|
namespace sprout {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
@ -30,16 +30,13 @@ namespace sprout {
|
||||||
template<typename ForwardIterator, typename T, typename Compare>
|
template<typename ForwardIterator, typename T, typename Compare>
|
||||||
inline SPROUT_CONSTEXPR bool
|
inline SPROUT_CONSTEXPR bool
|
||||||
binary_search(ForwardIterator first, ForwardIterator last, T const& value, Compare comp) {
|
binary_search(ForwardIterator first, ForwardIterator last, T const& value, Compare comp) {
|
||||||
return sprout::detail::binary_search_impl(sprout::lower_bound(first, last, value), last, value, comp);
|
return sprout::detail::binary_search_impl(sprout::lower_bound(first, last, value, comp), last, value, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ForwardIterator, typename T>
|
template<typename ForwardIterator, typename T>
|
||||||
inline SPROUT_CONSTEXPR bool
|
inline SPROUT_CONSTEXPR bool
|
||||||
binary_search(ForwardIterator first, ForwardIterator last, T const& value) {
|
binary_search(ForwardIterator first, ForwardIterator last, T const& value) {
|
||||||
return sprout::binary_search(
|
return sprout::binary_search(first, last, value, sprout::less<>());
|
||||||
first, last, value,
|
|
||||||
NS_SSCRISK_CEL_OR_SPROUT::less<typename std::iterator_traits<ForwardIterator>::value_type>()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue