diff --git a/sprout/algorithm/fixed/partition_copy.hpp b/sprout/algorithm/fixed/partition_copy.hpp index b7659ce0..1a2b2c4f 100644 --- a/sprout/algorithm/fixed/partition_copy.hpp +++ b/sprout/algorithm/fixed/partition_copy.hpp @@ -1,11 +1,12 @@ #ifndef SPROUT_ALGORITHM_FIXED_PARTITION_COPY_HPP #define SPROUT_ALGORITHM_FIXED_PARTITION_COPY_HPP +#include #include #include #include #include -#include +#include #include namespace sprout { @@ -61,7 +62,7 @@ namespace sprout { Args const&... args ) { - return first != last && sizeof...(Args) < offset + return first != last && sizeof...(Args) < static_cast(offset) ? pred(*first) ? partition_copy_impl_2(sprout::next(first), last, result, pred, offset, *first, args...) : partition_copy_impl_2(sprout::next(first), last, result, pred, offset, args..., *first) @@ -96,7 +97,7 @@ namespace sprout { Args const&... args ) { - return sizeof...(Args) < offset + return sizeof...(Args) < static_cast(offset) ? partition_copy_impl_1(first, last, result, pred, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : partition_copy_impl_2(first, last, result, pred, offset + sprout::size(result), args...) ; diff --git a/sprout/algorithm/fixed/remove_copy.hpp b/sprout/algorithm/fixed/remove_copy.hpp index a3688814..f878aff9 100644 --- a/sprout/algorithm/fixed/remove_copy.hpp +++ b/sprout/algorithm/fixed/remove_copy.hpp @@ -1,11 +1,12 @@ #ifndef SPROUT_ALGORITHM_FIXED_REMOVE_COPY_HPP #define SPROUT_ALGORITHM_FIXED_REMOVE_COPY_HPP +#include #include #include #include #include -#include +#include #include namespace sprout { @@ -61,7 +62,7 @@ namespace sprout { Args const&... args ) { - return first != last && sizeof...(Args) < offset + return first != last && sizeof...(Args) < static_cast(offset) ? *first == value ? remove_copy_impl_2(sprout::next(first), last, result, value, offset, args...) : remove_copy_impl_2(sprout::next(first), last, result, value, offset, args..., *first) @@ -96,7 +97,7 @@ namespace sprout { Args const&... args ) { - return sizeof...(Args) < offset + return sizeof...(Args) < static_cast(offset) ? remove_copy_impl_1(first, last, result, value, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : remove_copy_impl_2(first, last, result, value, offset + sprout::size(result), args...) ; diff --git a/sprout/algorithm/fixed/remove_copy_if.hpp b/sprout/algorithm/fixed/remove_copy_if.hpp index 74479257..8aeaaa33 100644 --- a/sprout/algorithm/fixed/remove_copy_if.hpp +++ b/sprout/algorithm/fixed/remove_copy_if.hpp @@ -1,11 +1,12 @@ #ifndef SPROUT_ALGORITHM_FIXED_REMOVE_COPY_IF_HPP #define SPROUT_ALGORITHM_FIXED_REMOVE_COPY_IF_HPP +#include #include #include #include #include -#include +#include #include namespace sprout { @@ -61,7 +62,7 @@ namespace sprout { Args const&... args ) { - return first != last && sizeof...(Args) < offset + return first != last && sizeof...(Args) < static_cast(offset) ? pred(*first) ? remove_copy_if_impl_2(sprout::next(first), last, result, pred, offset, args...) : remove_copy_if_impl_2(sprout::next(first), last, result, pred, offset, args..., *first) @@ -96,7 +97,7 @@ namespace sprout { Args const&... args ) { - return sizeof...(Args) < offset + return sizeof...(Args) < static_cast(offset) ? remove_copy_if_impl_1(first, last, result, pred, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : remove_copy_if_impl_2(first, last, result, pred, offset + sprout::size(result), args...) ; diff --git a/sprout/algorithm/fixed/replace_copy.hpp b/sprout/algorithm/fixed/replace_copy.hpp index 0a51f9ce..badf6ce3 100644 --- a/sprout/algorithm/fixed/replace_copy.hpp +++ b/sprout/algorithm/fixed/replace_copy.hpp @@ -11,6 +11,7 @@ #include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL +#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { namespace fixed { @@ -32,7 +33,7 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? *sprout::next(first, Indexes - offset) == old_value ? new_value : *sprout::next(first, Indexes - offset) + ? NS_SSCRISK_CEL_OR_SPROUT_DETAIL::equal_to()(*sprout::next(first, Indexes - offset), old_value) ? new_value : *sprout::next(first, Indexes - offset) : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); diff --git a/sprout/algorithm/fixed/sort.hpp b/sprout/algorithm/fixed/sort.hpp index bd935201..bf3f44d7 100644 --- a/sprout/algorithm/fixed/sort.hpp +++ b/sprout/algorithm/fixed/sort.hpp @@ -14,6 +14,24 @@ namespace sprout { namespace fixed { namespace detail { + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type sort_lr( + Container const& cont, + typename sprout::fixed_container_traits::difference_type start, + typename sprout::fixed_container_traits::difference_type end, + Compare comp, + typename sprout::fixed_container_traits::difference_type l, + typename sprout::fixed_container_traits::difference_type r, + typename sprout::fixed_container_traits::value_type const& p + ); + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type sort_start( + Container const& cont, + typename sprout::fixed_container_traits::difference_type start, + typename sprout::fixed_container_traits::difference_type end, + Compare comp + ); + template SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::value_type const& sort_select_pivot( Iterator origin, @@ -128,64 +146,80 @@ namespace sprout { { // pivot を選択してソートを開始 return sort_lr(cont, start, end, comp, start, end, sort_select_pivot(sprout::fixed_begin(cont), start, end)); } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + (sprout::fixed_container_traits::fixed_size <= 1), + typename sprout::fixed::result_of::algorithm::type + >::type sort( + Container const& cont, + Compare comp + ) + { + return sprout::clone(cont); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + (sprout::fixed_container_traits::fixed_size > 1), + typename sprout::fixed::result_of::algorithm::type + >::type sort( + Container const& cont, + Compare comp + ) + { + return sprout::fixed::detail::sort_start( + cont, + sprout::fixed_begin_offset(cont), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::end(cont) - 1), + comp + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + (sprout::fixed_container_traits::fixed_size <= 1), + typename sprout::fixed::result_of::algorithm::type + >::type sort( + Container const& cont + ) + { + return sprout::clone(cont); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + (sprout::fixed_container_traits::fixed_size > 1), + typename sprout::fixed::result_of::algorithm::type + >::type sort( + Container const& cont + ) + { + return sprout::fixed::detail::sort_start( + cont, + sprout::fixed_begin_offset(cont), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::end(cont) - 1), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>() + ); + } } // namespace detail // + // sort // template - SPROUT_CONSTEXPR inline typename std::enable_if< - (sprout::fixed_container_traits::fixed_size <= 1), - typename sprout::fixed::result_of::algorithm::type - >::type sort( + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type sort( Container const& cont, Compare comp ) { - return sprout::clone(cont); - } - template - SPROUT_CONSTEXPR inline typename std::enable_if< - (sprout::fixed_container_traits::fixed_size > 1), - typename sprout::fixed::result_of::algorithm::type - >::type sort( - Container const& cont, - Compare comp - ) - { - return sprout::fixed::detail::sort_start( - cont, - sprout::fixed_begin_offset(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::end(cont) - 1), - comp - ); + return sprout::fixed::detail::sort(cont, comp); } // // sort // template - SPROUT_CONSTEXPR inline typename std::enable_if< - (sprout::fixed_container_traits::fixed_size <= 1), - typename sprout::fixed::result_of::algorithm::type - >::type sort( + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type sort( Container const& cont ) { - return sprout::clone(cont); - } - template - SPROUT_CONSTEXPR inline typename std::enable_if< - (sprout::fixed_container_traits::fixed_size > 1), - typename sprout::fixed::result_of::algorithm::type - >::type sort( - Container const& cont - ) - { - return sprout::fixed::detail::sort_start( - cont, - sprout::fixed_begin_offset(cont), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::end(cont) - 1), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>() - ); + return sprout::fixed::detail::sort(cont); } } // namespace fixed diff --git a/sprout/algorithm/fixed/stable_partition_copy.hpp b/sprout/algorithm/fixed/stable_partition_copy.hpp index 172e7e6d..09f297c5 100644 --- a/sprout/algorithm/fixed/stable_partition_copy.hpp +++ b/sprout/algorithm/fixed/stable_partition_copy.hpp @@ -1,11 +1,12 @@ #ifndef SPROUT_ALGORITHM_FIXED_STABLE_PARTITION_COPY_HPP #define SPROUT_ALGORITHM_FIXED_STABLE_PARTITION_COPY_HPP +#include #include #include #include #include -#include +#include #include namespace sprout { @@ -34,13 +35,13 @@ namespace sprout { return stable_partition_copy_impl_4(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } - template + template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size == sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type stable_partition_copy_impl_3( - InputIterator first, - InputIterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -49,20 +50,20 @@ namespace sprout { { return sprout::remake_clone(result, sprout::size(result), args...); } - template + template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size != sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type stable_partition_copy_impl_3( - InputIterator first, - InputIterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, Args const&... args ) { - return first != last && sizeof...(Args) < offset + return first != last && sizeof...(Args) < static_cast(offset) ? !pred(*first) ? stable_partition_copy_impl_3(sprout::next(first), last, result, pred, offset, args..., *first) : stable_partition_copy_impl_3(sprout::next(first), last, result, pred, offset, args...) @@ -70,82 +71,82 @@ namespace sprout { ; } - template + template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size == sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type stable_partition_copy_impl_2( - InputIterator first, - InputIterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, - InputIterator origin, + BidirectionalIterator origin, Args const&... args ) { return sprout::remake_clone(result, sprout::size(result), args...); } - template + template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size != sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type stable_partition_copy_impl_2( - InputIterator first, - InputIterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, - InputIterator origin, + BidirectionalIterator origin, Args const&... args ) { - return first != last && sizeof...(Args) < offset + return first != last && sizeof...(Args) < static_cast(offset) ? pred(*first) ? stable_partition_copy_impl_2(sprout::next(first), last, result, pred, offset, origin, args..., *first) : stable_partition_copy_impl_2(sprout::next(first), last, result, pred, offset, origin, args...) : stable_partition_copy_impl_3(origin, last, result, pred, offset, args...) ; } - template + template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size == sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type stable_partition_copy_impl_1( - InputIterator first, - InputIterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, - InputIterator origin, + BidirectionalIterator origin, Args const&... args ) { return sprout::remake_clone(result, sprout::size(result), args...); } - template + template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size != sizeof...(Args), typename sprout::fixed::result_of::algorithm::type >::type stable_partition_copy_impl_1( - InputIterator first, - InputIterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, - InputIterator origin, + BidirectionalIterator origin, Args const&... args ) { - return sizeof...(Args) < offset + return sizeof...(Args) < static_cast(offset) ? stable_partition_copy_impl_1(first, last, result, pred, offset, origin, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : stable_partition_copy_impl_2(first, last, result, pred, offset + sprout::size(result), origin, args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type stable_partition_copy_impl( - InputIterator first, - InputIterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, Predicate pred ) @@ -156,10 +157,10 @@ namespace sprout { // // stable_partition_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type stable_partition_copy( - InputIterator first, - InputIterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, Predicate pred ) diff --git a/sprout/algorithm/fixed/stable_sort.hpp b/sprout/algorithm/fixed/stable_sort.hpp index ddc8df39..371ed858 100644 --- a/sprout/algorithm/fixed/stable_sort.hpp +++ b/sprout/algorithm/fixed/stable_sort.hpp @@ -198,62 +198,77 @@ namespace sprout { { return stable_sort_impl_1(cont, comp, sprout::index_tuple(), sprout::index_tuple<>(), sprout::index_tuple<>(), sprout::index_tuple<>()); } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + (sprout::fixed_container_traits::fixed_size <= 1), + typename sprout::fixed::result_of::algorithm::type + >::type stable_sort( + Container const& cont, + Compare comp + ) + { + return sprout::clone(cont); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + (sprout::fixed_container_traits::fixed_size > 1), + typename sprout::fixed::result_of::algorithm::type + >::type stable_sort( + Container const& cont, + Compare comp + ) + { + return sprout::fixed::detail::stable_sort_impl( + cont, + comp, + typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type() + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + (sprout::fixed_container_traits::fixed_size <= 1), + typename sprout::fixed::result_of::algorithm::type + >::type stable_sort( + Container const& cont + ) + { + return sprout::clone(cont); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + (sprout::fixed_container_traits::fixed_size > 1), + typename sprout::fixed::result_of::algorithm::type + >::type stable_sort( + Container const& cont + ) + { + return sprout::fixed::detail::stable_sort_impl( + cont, + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), + typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type() + ); + } } // namespace detail // // stable_sort // template - SPROUT_CONSTEXPR inline typename std::enable_if< - (sprout::fixed_container_traits::fixed_size <= 1), - typename sprout::fixed::result_of::algorithm::type - >::type stable_sort( + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type stable_sort( Container const& cont, Compare comp ) { - return sprout::clone(cont); - } - template - SPROUT_CONSTEXPR inline typename std::enable_if< - (sprout::fixed_container_traits::fixed_size > 1), - typename sprout::fixed::result_of::algorithm::type - >::type stable_sort( - Container const& cont, - Compare comp - ) - { - return sprout::fixed::detail::stable_sort_impl( - cont, - comp, - typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type() - ); + return sprout::fixed::detail::stable_sort(cont, comp); } // // stable_sort // template - SPROUT_CONSTEXPR inline typename std::enable_if< - (sprout::fixed_container_traits::fixed_size <= 1), - typename sprout::fixed::result_of::algorithm::type - >::type stable_sort( - Container const& cont - ) - { - return sprout::clone(cont); - } - template - SPROUT_CONSTEXPR inline typename std::enable_if< - (sprout::fixed_container_traits::fixed_size > 1), - typename sprout::fixed::result_of::algorithm::type - >::type stable_sort( + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type stable_sort( Container const& cont ) { - return sprout::fixed::detail::stable_sort_impl( - cont, - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less::value_type>(), - typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type() - ); + return sprout::fixed::detail::stable_sort(cont); } } // namespace fixed diff --git a/sprout/algorithm/fixed/unique_copy.hpp b/sprout/algorithm/fixed/unique_copy.hpp index 42b1bb34..5070008d 100644 --- a/sprout/algorithm/fixed/unique_copy.hpp +++ b/sprout/algorithm/fixed/unique_copy.hpp @@ -1,11 +1,12 @@ #ifndef SPROUT_ALGORITHM_FIXED_UNIQUE_COPY_HPP #define SPROUT_ALGORITHM_FIXED_UNIQUE_COPY_HPP +#include #include #include #include #include -#include +#include #include namespace sprout { @@ -46,7 +47,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args..., head); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -61,7 +62,7 @@ namespace sprout { Args const&... args ) { - return first != last && sizeof...(Args) + 1 < offset + return first != last && sizeof...(Args) + 1 < static_cast(offset) ? !(head == *first) ? unique_copy_impl_2(sprout::next(first), last, result, offset, *first, args..., head) : unique_copy_impl_2(sprout::next(first), last, result, offset, head, args...) @@ -94,9 +95,11 @@ namespace sprout { Args const&... args ) { - return sizeof...(Args) < offset + return sizeof...(Args) < static_cast(offset) ? unique_copy_impl_1(first, last, result, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) - : unique_copy_impl_2(sprout::next(first), last, result, offset + sprout::size(result), *first, args...) + : first != last + ? unique_copy_impl_2(sprout::next(first), last, result, offset + sprout::size(result), *first, args...) + : unique_copy_impl_3(result, args...) ; } template @@ -137,7 +140,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args..., head); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -153,7 +156,7 @@ namespace sprout { Args const&... args ) { - return first != last && sizeof...(Args) + 1 < offset + return first != last && sizeof...(Args) + 1 < static_cast(offset) ? !pred(head, *first) ? unique_copy_impl_2(sprout::next(first), last, result, pred, offset, *first, args..., head) : unique_copy_impl_2(sprout::next(first), last, result, pred, offset, head, args...) @@ -188,9 +191,11 @@ namespace sprout { Args const&... args ) { - return sizeof...(Args) < offset + return sizeof...(Args) < static_cast(offset) ? unique_copy_impl_1(first, last, result, pred, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) - : unique_copy_impl_2(sprout::next(first), last, result, pred, offset + sprout::size(result), *first, args...) + : first != last + ? unique_copy_impl_2(sprout::next(first), last, result, pred, offset + sprout::size(result), *first, args...) + : unique_copy_impl_3(result, args...) ; } template diff --git a/sprout/detail/functional.hpp b/sprout/detail/functional.hpp index 4f66da6e..1c366f96 100644 --- a/sprout/detail/functional.hpp +++ b/sprout/detail/functional.hpp @@ -6,6 +6,19 @@ namespace sprout { namespace detail { + // + // equal_to + // + template + class equal_to + : public std::binary_function + { + public: + SPROUT_CONSTEXPR bool operator()(T const& lhs, T const& rhs) const { + return lhs == rhs; + } + }; + // // less // diff --git a/sprout/range/numeric.hpp b/sprout/range/numeric.hpp new file mode 100644 index 00000000..8f0f533e --- /dev/null +++ b/sprout/range/numeric.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_HPP +#define SPROUT_RANGE_NUMERIC_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_HPP diff --git a/sprout/range/numeric/adjacent_difference.hpp b/sprout/range/numeric/adjacent_difference.hpp new file mode 100644 index 00000000..96d04927 --- /dev/null +++ b/sprout/range/numeric/adjacent_difference.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_ADJACENT_DIFFERENCE_HPP +#define SPROUT_RANGE_NUMERIC_ADJACENT_DIFFERENCE_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_ADJACENT_DIFFERENCE_HPP diff --git a/sprout/range/numeric/fit.hpp b/sprout/range/numeric/fit.hpp new file mode 100644 index 00000000..a1b89fb1 --- /dev/null +++ b/sprout/range/numeric/fit.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_FIT_HPP +#define SPROUT_RANGE_NUMERIC_FIT_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_FIT_HPP diff --git a/sprout/range/numeric/fit/adjacent_difference.hpp b/sprout/range/numeric/fit/adjacent_difference.hpp new file mode 100644 index 00000000..d18edb7f --- /dev/null +++ b/sprout/range/numeric/fit/adjacent_difference.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_RANGE_NUMERIC_FIT_ADJACENT_DIFFERENCE_HPP +#define SPROUT_RANGE_NUMERIC_FIT_ADJACENT_DIFFERENCE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + namespace fit { + // + // adjacent_difference + // + template + SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type adjacent_difference( + Input const& input, + Result const& result + ) + { + return sprout::fit::adjacent_difference(sprout::begin(input), sprout::end(input), result); + } + // + // adjacent_difference + // + template + SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type adjacent_difference( + Input const& input, + Result const& result, + BinaryOperation binary_op + ) + { + return sprout::fit::adjacent_difference(sprout::begin(input), sprout::end(input), result, binary_op); + } + } // namespace fit + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_NUMERIC_FIT_ADJACENT_DIFFERENCE_HPP diff --git a/sprout/range/numeric/fit/partial_sum.hpp b/sprout/range/numeric/fit/partial_sum.hpp new file mode 100644 index 00000000..de439e15 --- /dev/null +++ b/sprout/range/numeric/fit/partial_sum.hpp @@ -0,0 +1,40 @@ +#ifndef SPROUT_RANGE_NUMERIC_FIT_PARTIAL_SUM_HPP +#define SPROUT_RANGE_NUMERIC_FIT_PARTIAL_SUM_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + namespace fit { + // + // partial_sum + // + template + SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type partial_sum( + Input const& input, + Result const& result + ) + { + return sprout::fit::partial_sum(sprout::begin(input), sprout::end(input), result); + } + // + // partial_sum + // + template + SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type partial_sum( + Input const& input, + Result const& result, + BinaryOperation binary_op + ) + { + return sprout::fit::partial_sum(sprout::begin(input), sprout::end(input), result, binary_op); + } + } // namespace fit + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_NUMERIC_FIT_PARTIAL_SUM_HPP diff --git a/sprout/range/numeric/fixed.hpp b/sprout/range/numeric/fixed.hpp new file mode 100644 index 00000000..a4f9027b --- /dev/null +++ b/sprout/range/numeric/fixed.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_FIXED_HPP +#define SPROUT_RANGE_NUMERIC_FIXED_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_FIXED_HPP diff --git a/sprout/range/numeric/fixed/adjacent_difference.hpp b/sprout/range/numeric/fixed/adjacent_difference.hpp new file mode 100644 index 00000000..e3345541 --- /dev/null +++ b/sprout/range/numeric/fixed/adjacent_difference.hpp @@ -0,0 +1,42 @@ +#ifndef SPROUT_RANGE_NUMERIC_FIXED_ADJACENT_DIFFERENCE_HPP +#define SPROUT_RANGE_NUMERIC_FIXED_ADJACENT_DIFFERENCE_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + namespace fixed { + // + // adjacent_difference + // + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type adjacent_difference( + Input const& input, + Result const& result + ) + { + return sprout::fixed::adjacent_difference(sprout::begin(input), sprout::end(input), result); + } + // + // adjacent_difference + // + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type adjacent_difference( + Input const& input, + Result const& result, + BinaryOperation binary_op + ) + { + return sprout::fixed::adjacent_difference(sprout::begin(input), sprout::end(input), result, binary_op); + } + } // namespace fixed + + using sprout::range::fixed::adjacent_difference; + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_NUMERIC_FIXED_ADJACENT_DIFFERENCE_HPP diff --git a/sprout/range/numeric/fixed/partial_sum.hpp b/sprout/range/numeric/fixed/partial_sum.hpp new file mode 100644 index 00000000..429b0f83 --- /dev/null +++ b/sprout/range/numeric/fixed/partial_sum.hpp @@ -0,0 +1,42 @@ +#ifndef SPROUT_RANGE_NUMERIC_FIXED_PARTIAL_SUM_HPP +#define SPROUT_RANGE_NUMERIC_FIXED_PARTIAL_SUM_HPP + +#include +#include +#include +#include +#include + +namespace sprout { + namespace range { + namespace fixed { + // + // partial_sum + // + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type partial_sum( + Input const& input, + Result const& result + ) + { + return sprout::fixed::partial_sum(sprout::begin(input), sprout::end(input), result); + } + // + // partial_sum + // + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type partial_sum( + Input const& input, + Result const& result, + BinaryOperation binary_op + ) + { + return sprout::fixed::partial_sum(sprout::begin(input), sprout::end(input), result, binary_op); + } + } // namespace fixed + + using sprout::range::fixed::partial_sum; + } // namespace range +} // namespace sprout + +#endif // #ifndef SPROUT_RANGE_NUMERIC_FIXED_PARTIAL_SUM_HPP diff --git a/sprout/range/numeric/partial_sum.hpp b/sprout/range/numeric/partial_sum.hpp new file mode 100644 index 00000000..efd146d4 --- /dev/null +++ b/sprout/range/numeric/partial_sum.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_RANGE_NUMERIC_PARTIAL_SUM_HPP +#define SPROUT_RANGE_NUMERIC_PARTIAL_SUM_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_RANGE_NUMERIC_PARTIAL_SUM_HPP