1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix numeric algorithms SFINAE

This commit is contained in:
bolero-MURAKAMI 2014-04-06 12:25:26 +09:00
parent 27f9f47027
commit a090307cc2
2 changed files with 58 additions and 6 deletions

View file

@ -13,6 +13,8 @@
#include <sprout/container/traits.hpp> #include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp> #include <sprout/container/functions.hpp>
#include <sprout/iterator/operation.hpp> #include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#include <sprout/algorithm/fixed/results.hpp> #include <sprout/algorithm/fixed/results.hpp>
#include <sprout/pit/pit.hpp> #include <sprout/pit/pit.hpp>
#include <sprout/detail/container_complate.hpp> #include <sprout/detail/container_complate.hpp>
@ -87,7 +89,6 @@ namespace sprout {
adjacent_difference(InputIterator first, InputIterator last, Result const& result) { adjacent_difference(InputIterator first, InputIterator last, Result const& result) {
return sprout::fixed::detail::adjacent_difference_impl(first, last, result, sprout::size(result)); return sprout::fixed::detail::adjacent_difference_impl(first, last, result, sprout::size(result));
} }
template<typename Result, typename InputIterator> template<typename Result, typename InputIterator>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
adjacent_difference(InputIterator first, InputIterator last) { adjacent_difference(InputIterator first, InputIterator last) {
@ -162,7 +163,6 @@ namespace sprout {
adjacent_difference(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) { adjacent_difference(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) {
return sprout::fixed::detail::adjacent_difference_impl(first, last, result, binary_op, sprout::size(result)); return sprout::fixed::detail::adjacent_difference_impl(first, last, result, binary_op, sprout::size(result));
} }
template<typename Result, typename InputIterator, typename BinaryOperation> template<typename Result, typename InputIterator, typename BinaryOperation>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
adjacent_difference(InputIterator first, InputIterator last, BinaryOperation binary_op) { adjacent_difference(InputIterator first, InputIterator last, BinaryOperation binary_op) {
@ -170,7 +170,33 @@ namespace sprout {
} }
} // namespace fixed } // namespace fixed
using sprout::fixed::adjacent_difference; template<
typename InputIterator, typename Result,
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
adjacent_difference(InputIterator first, InputIterator last, Result const& result) {
return sprout::fixed::adjacent_difference(first, last, result);
}
template<typename Result, typename InputIterator>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
adjacent_difference(InputIterator first, InputIterator last) {
return sprout::fixed::adjacent_difference<Result>(first, last);
}
template<
typename InputIterator, typename Result, typename BinaryOperation,
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
adjacent_difference(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) {
return sprout::fixed::adjacent_difference(first, last, result, binary_op);
}
template<typename Result, typename InputIterator, typename BinaryOperation>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
adjacent_difference(InputIterator first, InputIterator last, BinaryOperation binary_op) {
return sprout::fixed::adjacent_difference<Result>(first, last, binary_op);
}
} // namespace sprout } // namespace sprout
#endif // #ifndef SPROUT_NUMERIC_FIXED_ADJACENT_DIFFERENCE_HPP #endif // #ifndef SPROUT_NUMERIC_FIXED_ADJACENT_DIFFERENCE_HPP

View file

@ -13,6 +13,8 @@
#include <sprout/container/traits.hpp> #include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp> #include <sprout/container/functions.hpp>
#include <sprout/iterator/operation.hpp> #include <sprout/iterator/operation.hpp>
#include <sprout/iterator/type_traits/is_iterator_of.hpp>
#include <sprout/type_traits/enabler_if.hpp>
#include <sprout/algorithm/fixed/results.hpp> #include <sprout/algorithm/fixed/results.hpp>
#include <sprout/pit/pit.hpp> #include <sprout/pit/pit.hpp>
#include <sprout/detail/container_complate.hpp> #include <sprout/detail/container_complate.hpp>
@ -87,7 +89,6 @@ namespace sprout {
partial_sum(InputIterator first, InputIterator last, Result const& result) { partial_sum(InputIterator first, InputIterator last, Result const& result) {
return sprout::fixed::detail::partial_sum_impl(first, last, result, sprout::size(result)); return sprout::fixed::detail::partial_sum_impl(first, last, result, sprout::size(result));
} }
template<typename Result, typename InputIterator> template<typename Result, typename InputIterator>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
partial_sum(InputIterator first, InputIterator last) { partial_sum(InputIterator first, InputIterator last) {
@ -162,7 +163,6 @@ namespace sprout {
partial_sum(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) { partial_sum(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) {
return sprout::fixed::detail::partial_sum_impl(first, last, result, binary_op, sprout::size(result)); return sprout::fixed::detail::partial_sum_impl(first, last, result, binary_op, sprout::size(result));
} }
template<typename Result, typename InputIterator, typename BinaryOperation> template<typename Result, typename InputIterator, typename BinaryOperation>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
partial_sum(InputIterator first, InputIterator last, BinaryOperation binary_op) { partial_sum(InputIterator first, InputIterator last, BinaryOperation binary_op) {
@ -170,7 +170,33 @@ namespace sprout {
} }
} // namespace fixed } // namespace fixed
using sprout::fixed::partial_sum; template<
typename InputIterator, typename Result,
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
partial_sum(InputIterator first, InputIterator last, Result const& result) {
return sprout::fixed::partial_sum(first, last, result);
}
template<typename Result, typename InputIterator>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
partial_sum(InputIterator first, InputIterator last) {
return sprout::fixed::partial_sum<Result>(first, last);
}
template<
typename InputIterator, typename Result, typename BinaryOperation,
typename sprout::enabler_if<!sprout::is_iterator_outputable<Result>::value>::type = sprout::enabler
>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
partial_sum(InputIterator first, InputIterator last, Result const& result, BinaryOperation binary_op) {
return sprout::fixed::partial_sum(first, last, result, binary_op);
}
template<typename Result, typename InputIterator, typename BinaryOperation>
inline SPROUT_CONSTEXPR typename sprout::fixed::results::algorithm<Result>::type
partial_sum(InputIterator first, InputIterator last, BinaryOperation binary_op) {
return sprout::fixed::partial_sum<Result>(first, last, binary_op);
}
} // namespace sprout } // namespace sprout
#endif // #ifndef SPROUT_NUMERIC_FIXED_PARTIAL_SUM_HPP #endif // #ifndef SPROUT_NUMERIC_FIXED_PARTIAL_SUM_HPP