fix recursion depth O(logN): some algorithms

This commit is contained in:
bolero-MURAKAMI 2013-01-03 17:01:50 +09:00
commit 5019f6aa96
162 changed files with 3600 additions and 1659 deletions

View file

@ -9,7 +9,7 @@
#include <sprout/iterator/ptr_index_iterator.hpp>
#include <sprout/algorithm/tristate_lexicographical_compare.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
namespace sprout {
//
@ -180,7 +180,7 @@ namespace sprout {
};
public:
static SPROUT_CONSTEXPR std::size_t length(char_type const* s, std::size_t n) {
return NS_SSCRISK_CEL_OR_SPROUT::distance(
return sprout::distance(
sprout::as_iterator(s),
find(sprout::as_iterator(s), n, char_type())
);
@ -199,7 +199,7 @@ namespace sprout {
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
template<typename ConstIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstIterator s, std::size_t n) {
return NS_SSCRISK_CEL_OR_SPROUT::distance(
return sprout::distance(
s,
find(s, n, char_type())
);

View file

@ -15,7 +15,7 @@
#include <sprout/string/char_traits.hpp>
#include <sprout/string/npos.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
# include <sprout/iterator/index_iterator.hpp>
#endif
@ -821,7 +821,7 @@ namespace sprout {
template<std::size_t M>
static SPROUT_CONSTEXPR typename copied_type::size_type
length_impl(sprout::array<T, M> const& arr) {
return NS_SSCRISK_CEL_OR_SPROUT::distance(
return sprout::distance(
arr.begin(),
NS_SSCRISK_CEL_OR_SPROUT::find(arr.begin(), arr.end(), T())
);