1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix recursion depth O(logN): some algorithms

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

View file

@ -4,7 +4,5 @@
#include <sprout/config.hpp>
#include <sprout/range/numeric/accumulate.hpp>
#include <sprout/range/numeric/inner_product.hpp>
#include <sprout/range/numeric/unstable_accumulate.hpp>
#include <sprout/range/numeric/unstable_inner_product.hpp>
#endif // #ifndef SPROUT_RANGE_NUMERIC_NON_MODIFYIING_HPP

View file

@ -1,26 +0,0 @@
#ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_ACCUMLATE_HPP
#define SPROUT_RANGE_NUMERIC_UNSTABLE_ACCUMLATE_HPP
#include <sprout/config.hpp>
#include <sprout/numeric/unstable_accumulate.hpp>
namespace sprout {
namespace range {
//
// unstable_accumulate
//
template<typename Range, typename T, typename BinaryOperation>
inline SPROUT_CONSTEXPR T
unstable_accumulate(Range const& range, T init, BinaryOperation binary_op) {
return sprout::unstable_accumulate(sprout::begin(range), sprout::end(range), init, binary_op);
}
template<typename Range, typename T>
inline SPROUT_CONSTEXPR T
unstable_accumulate(Range const& range, T init) {
return sprout::unstable_accumulate(sprout::begin(range), sprout::end(range), init);
}
} // namespace range
} // namespace sprout
#endif // #ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_ACCUMLATE_HPP

View file

@ -1,30 +0,0 @@
#ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_INNER_PRODUCT_HPP
#define SPROUT_RANGE_NUMERIC_UNSTABLE_INNER_PRODUCT_HPP
#include <sprout/config.hpp>
#include <sprout/numeric/unstable_inner_product.hpp>
namespace sprout {
namespace range {
//
// unstable_inner_product
//
template<typename Range1, typename Range2, typename T, typename BinaryOperation1, typename BinaryOperation2>
inline SPROUT_CONSTEXPR T
unstable_inner_product(
Range1 const& range1, Range2 const& range2, T init,
BinaryOperation1 binary_op1, BinaryOperation2 binary_op2
)
{
return sprout::unstable_inner_product(sprout::begin(range1), sprout::end(range1), sprout::begin(range2), init, binary_op1, binary_op2);
}
template<typename Range1, typename Range2, typename T>
inline SPROUT_CONSTEXPR T
unstable_inner_product(Range1 const& range1, Range2 const& range2, T init) {
return sprout::unstable_inner_product(sprout::begin(range1), sprout::end(range1), sprout::begin(range2), init);
}
} // namespace range
} // namespace sprout
#endif // #ifndef SPROUT_RANGE_NUMERIC_UNSTABLE_INNER_PRODUCT_HPP

View file

@ -6,7 +6,7 @@
#include <sprout/config.hpp>
#include <sprout/iterator/ptr_index_iterator.hpp>
#include <sprout/range/range_container.hpp>
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT
#include <sprout/iterator/operation.hpp>
namespace sprout {
namespace range {
@ -27,7 +27,7 @@ namespace sprout {
make_ptr_range(T* first, T* last) {
return sprout::range::range_container<sprout::ptr_index_iterator<T> >(
sprout::ptr_index_iterator<T>(first),
sprout::ptr_index_iterator<T>(first, NS_SSCRISK_CEL_OR_SPROUT::distance(first, last))
sprout::ptr_index_iterator<T>(first, sprout::distance(first, last))
);
}