diff --git a/sprout/algorithm/fit/copy.hpp b/sprout/algorithm/fit/copy.hpp index 3b52a064..ec28c0f3 100644 --- a/sprout/algorithm/fit/copy.hpp +++ b/sprout/algorithm/fit/copy.hpp @@ -13,10 +13,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -31,10 +31,10 @@ namespace sprout { // // copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result ) { diff --git a/sprout/algorithm/fit/copy_backward.hpp b/sprout/algorithm/fit/copy_backward.hpp index a046f374..832ac936 100644 --- a/sprout/algorithm/fit/copy_backward.hpp +++ b/sprout/algorithm/fit/copy_backward.hpp @@ -13,32 +13,32 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type copy_backward_impl( - Iterator first, - Iterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) { return sprout::sub_copy( sprout::get_fixed(sprout::fixed::copy_backward(first, last, result)), - offset, - offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)) + offset - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result)), + offset ); } } // namespace detail // // copy_backward // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type copy_backward( - Iterator first, - Iterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result ) { - return sprout::fit::detail::copy_backward_impl(first, last, result, sprout::fixed_begin_offset(result)); + return sprout::fit::detail::copy_backward_impl(first, last, result, sprout::fixed_end_offset(result)); } } // namespace fit } // namespace sprout diff --git a/sprout/algorithm/fit/copy_if.hpp b/sprout/algorithm/fit/copy_if.hpp index 207aaa43..868f08e5 100644 --- a/sprout/algorithm/fit/copy_if.hpp +++ b/sprout/algorithm/fit/copy_if.hpp @@ -12,10 +12,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type copy_if_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset @@ -31,10 +31,10 @@ namespace sprout { // // copy_if // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type copy_if( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) diff --git a/sprout/algorithm/fit/copy_n.hpp b/sprout/algorithm/fit/copy_n.hpp index e3bec4e7..11428b9a 100644 --- a/sprout/algorithm/fit/copy_n.hpp +++ b/sprout/algorithm/fit/copy_n.hpp @@ -12,9 +12,9 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type copy_n_impl( - Iterator first, + InputIterator first, Size n, Result const& result, typename sprout::fixed_container_traits::difference_type offset @@ -30,9 +30,9 @@ namespace sprout { // // copy_n // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type copy_n( - Iterator first, + InputIterator first, Size n, Result const& result ) diff --git a/sprout/algorithm/fit/merge.hpp b/sprout/algorithm/fit/merge.hpp index d3f08cd1..55cd8566 100644 --- a/sprout/algorithm/fit/merge.hpp +++ b/sprout/algorithm/fit/merge.hpp @@ -13,12 +13,12 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type merge_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset @@ -37,12 +37,12 @@ namespace sprout { // // merge // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type merge( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -51,12 +51,12 @@ namespace sprout { } namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type merge_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -74,12 +74,12 @@ namespace sprout { // // merge // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type merge( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fit/partition_copy.hpp b/sprout/algorithm/fit/partition_copy.hpp index 56122dde..86bf3026 100644 --- a/sprout/algorithm/fit/partition_copy.hpp +++ b/sprout/algorithm/fit/partition_copy.hpp @@ -12,10 +12,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type partition_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset @@ -31,10 +31,10 @@ namespace sprout { // // partition_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type partition_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) diff --git a/sprout/algorithm/fit/remove_copy.hpp b/sprout/algorithm/fit/remove_copy.hpp index 1dc99db9..2446043a 100644 --- a/sprout/algorithm/fit/remove_copy.hpp +++ b/sprout/algorithm/fit/remove_copy.hpp @@ -13,10 +13,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type remove_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& value, typename sprout::fixed_container_traits::difference_type offset @@ -32,10 +32,10 @@ namespace sprout { // // remove_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type remove_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& value ) diff --git a/sprout/algorithm/fit/remove_copy_if.hpp b/sprout/algorithm/fit/remove_copy_if.hpp index ba868242..71b20b5d 100644 --- a/sprout/algorithm/fit/remove_copy_if.hpp +++ b/sprout/algorithm/fit/remove_copy_if.hpp @@ -13,10 +13,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type remove_copy_if_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset @@ -32,10 +32,10 @@ namespace sprout { // // remove_copy_if // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type remove_copy_if( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) diff --git a/sprout/algorithm/fit/replace_copy.hpp b/sprout/algorithm/fit/replace_copy.hpp index ff8a68e2..4e2b67ed 100644 --- a/sprout/algorithm/fit/replace_copy.hpp +++ b/sprout/algorithm/fit/replace_copy.hpp @@ -13,10 +13,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type replace_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& old_value, T const& new_value, @@ -33,10 +33,10 @@ namespace sprout { // // replace_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type replace_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& old_value, T const& new_value diff --git a/sprout/algorithm/fit/replace_copy_if.hpp b/sprout/algorithm/fit/replace_copy_if.hpp index 0e6fecd6..e8e5e0de 100644 --- a/sprout/algorithm/fit/replace_copy_if.hpp +++ b/sprout/algorithm/fit/replace_copy_if.hpp @@ -13,10 +13,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type replace_copy_if_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, T const& new_value, @@ -33,10 +33,10 @@ namespace sprout { // // replace_copy_if // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type replace_copy_if( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, T const& new_value diff --git a/sprout/algorithm/fit/reverse_copy.hpp b/sprout/algorithm/fit/reverse_copy.hpp index 8b93b6b6..c01fb783 100644 --- a/sprout/algorithm/fit/reverse_copy.hpp +++ b/sprout/algorithm/fit/reverse_copy.hpp @@ -13,10 +13,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type reverse_copy_impl( - Iterator first, - Iterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -31,10 +31,10 @@ namespace sprout { // // reverse_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type reverse_copy( - Iterator first, - Iterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result ) { diff --git a/sprout/algorithm/fit/rotate_copy.hpp b/sprout/algorithm/fit/rotate_copy.hpp index 99ed4d5e..dfa6a1ac 100644 --- a/sprout/algorithm/fit/rotate_copy.hpp +++ b/sprout/algorithm/fit/rotate_copy.hpp @@ -13,11 +13,11 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type rotate_copy_impl( - Iterator first, - Iterator middle, - Iterator last, + ForwardIterator first, + ForwardIterator middle, + ForwardIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -32,11 +32,11 @@ namespace sprout { // // rotate_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type rotate_copy( - Iterator first, - Iterator middle, - Iterator last, + ForwardIterator first, + ForwardIterator middle, + ForwardIterator last, Result const& result ) { diff --git a/sprout/algorithm/fit/set_difference.hpp b/sprout/algorithm/fit/set_difference.hpp index a601b5fa..3102d3c1 100644 --- a/sprout/algorithm/fit/set_difference.hpp +++ b/sprout/algorithm/fit/set_difference.hpp @@ -14,12 +14,12 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_difference_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset @@ -40,12 +40,12 @@ namespace sprout { // // set_difference // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_difference( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -54,12 +54,12 @@ namespace sprout { } namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_difference_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -79,12 +79,12 @@ namespace sprout { // // set_difference // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_difference( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fit/set_intersection.hpp b/sprout/algorithm/fit/set_intersection.hpp index 94152fc9..3e729674 100644 --- a/sprout/algorithm/fit/set_intersection.hpp +++ b/sprout/algorithm/fit/set_intersection.hpp @@ -13,12 +13,12 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_intersection_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset @@ -37,12 +37,12 @@ namespace sprout { // // set_intersection // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_intersection( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -51,12 +51,12 @@ namespace sprout { } namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_intersection_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -74,12 +74,12 @@ namespace sprout { // // set_intersection // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_intersection( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fit/set_symmetric_difference.hpp b/sprout/algorithm/fit/set_symmetric_difference.hpp index 7c9a2b5d..642b0c43 100644 --- a/sprout/algorithm/fit/set_symmetric_difference.hpp +++ b/sprout/algorithm/fit/set_symmetric_difference.hpp @@ -14,12 +14,12 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_symmetric_difference_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset @@ -41,12 +41,12 @@ namespace sprout { // // set_symmetric_difference // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_symmetric_difference( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -55,12 +55,12 @@ namespace sprout { } namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_symmetric_difference_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -81,12 +81,12 @@ namespace sprout { // // set_symmetric_difference // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_symmetric_difference( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fit/set_union.hpp b/sprout/algorithm/fit/set_union.hpp index 113716bc..5a716b87 100644 --- a/sprout/algorithm/fit/set_union.hpp +++ b/sprout/algorithm/fit/set_union.hpp @@ -14,12 +14,12 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_union_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset @@ -41,12 +41,12 @@ namespace sprout { // // set_union // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_union( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -55,12 +55,12 @@ namespace sprout { } namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_union_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -81,12 +81,12 @@ namespace sprout { // // set_union // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type set_union( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fit/stable_partition_copy.hpp b/sprout/algorithm/fit/stable_partition_copy.hpp index 4632ac6f..0d92d073 100644 --- a/sprout/algorithm/fit/stable_partition_copy.hpp +++ b/sprout/algorithm/fit/stable_partition_copy.hpp @@ -12,10 +12,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type stable_partition_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset @@ -31,10 +31,10 @@ namespace sprout { // // stable_partition_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type stable_partition_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) diff --git a/sprout/algorithm/fit/swap_element_copy.hpp b/sprout/algorithm/fit/swap_element_copy.hpp index 49276e0e..cc8ed704 100644 --- a/sprout/algorithm/fit/swap_element_copy.hpp +++ b/sprout/algorithm/fit/swap_element_copy.hpp @@ -13,13 +13,13 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type swap_element_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, - Iterator pos1, - Iterator pos2, + InputIterator pos1, + InputIterator pos2, typename sprout::fixed_container_traits::difference_type offset ) { @@ -33,13 +33,13 @@ namespace sprout { // // swap_element_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type swap_element_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, - Iterator pos1, - Iterator pos2 + InputIterator pos1, + InputIterator pos2 ) { return sprout::fit::detail::swap_element_copy_impl(first, last, result, pos1, pos2, sprout::fixed_begin_offset(result)); diff --git a/sprout/algorithm/fit/unique_copy.hpp b/sprout/algorithm/fit/unique_copy.hpp index 37e3afdc..cc7abb9c 100644 --- a/sprout/algorithm/fit/unique_copy.hpp +++ b/sprout/algorithm/fit/unique_copy.hpp @@ -14,10 +14,10 @@ namespace sprout { namespace fit { namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type unique_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset ) @@ -32,10 +32,10 @@ namespace sprout { // // unique_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type unique_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result ) { @@ -43,10 +43,10 @@ namespace sprout { } namespace detail { - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type unique_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, BinaryPredicate pred, typename sprout::fixed_container_traits::difference_type offset @@ -62,10 +62,10 @@ namespace sprout { // // unique_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm::type unique_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, BinaryPredicate pred ) diff --git a/sprout/algorithm/fixed/copy_backward.hpp b/sprout/algorithm/fixed/copy_backward.hpp index 057e72e7..9f241386 100644 --- a/sprout/algorithm/fixed/copy_backward.hpp +++ b/sprout/algorithm/fixed/copy_backward.hpp @@ -2,6 +2,8 @@ #define SPROUT_ALGORITHM_FIXED_COPY_BACKWARD_HPP #include +#include +#include #include #include #include @@ -13,10 +15,10 @@ namespace sprout { namespace fixed { namespace detail { - template - SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_backward_impl( - Iterator first, - Iterator last, + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_backward_impl_ra( + RandomAccessIterator first, + RandomAccessIterator last, Result const& result, sprout::index_tuple, typename sprout::fixed_container_traits::difference_type offset, @@ -27,31 +29,154 @@ namespace sprout { return sprout::remake_clone( result, sprout::size(result), - (Indexes < offset && Indexes + size >= offset && Indexes + input_size >= offset + (Indexes < offset && Indexes + size >= static_cast(offset) && Indexes + input_size >= static_cast(offset) ? *sprout::next(last, Indexes - offset) : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_backward( + RandomAccessIterator first, + RandomAccessIterator last, + Result const& result, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::copy_backward_impl_ra( + first, + last, + result, + typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), + sprout::fixed_end_offset(result), + sprout::size(result), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_backward_impl_3( + Result const& result, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_backward_impl_3( + Result const& result, + Args const&... args + ) + { + return copy_backward_impl_3(result, *sprout::prev(sprout::fixed_end(result), sizeof...(Args) + 1), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_backward_impl_2( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_backward_impl_2( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return first != last && sizeof...(Args) < static_cast(offset) + ? copy_backward_impl_2(first, sprout::prev(last), result, offset, *sprout::prev(last), args...) + : copy_backward_impl_3(result, args...) + ; + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_backward_impl_1( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_backward_impl_1( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sizeof...(Args) < static_cast(offset) + ? copy_backward_impl_1(first, last, result, offset, *sprout::prev(sprout::fixed_end(result), sizeof...(Args) + 1), args...) + : copy_backward_impl_2(first, last, result, offset + sprout::size(result), args...) + ; + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_backward_impl( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result + ) + { + return copy_backward_impl_1(first, last, result, sprout::fixed_end_offset(result)); + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_backward( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + void* + ) + { + return sprout::fixed::detail::copy_backward_impl( + first, + last, + result + ); + } } // namespace detail // // copy_backward // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_backward( - Iterator first, - Iterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result ) { - return sprout::fixed::detail::copy_backward_impl( + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::copy_backward( first, last, result, - typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), - sprout::fixed_end_offset(result), - sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + category() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/copy_n.hpp b/sprout/algorithm/fixed/copy_n.hpp index 88f26f96..3e6391a1 100644 --- a/sprout/algorithm/fixed/copy_n.hpp +++ b/sprout/algorithm/fixed/copy_n.hpp @@ -1,6 +1,8 @@ #ifndef SPROUT_ALGORITHM_FIXED_COPY_N_HPP #define SPROUT_ALGORITHM_FIXED_COPY_N_HPP +#include +#include #include #include #include @@ -10,20 +12,145 @@ namespace sprout { namespace fixed { + namespace detail { + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_n( + RandomAccessIterator first, + Size n, + Result const& result, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::copy( + first, + sprout::next(first, n), + result + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_n_impl_3( + Result const& result, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_n_impl_3( + Result const& result, + Args const&... args + ) + { + return copy_n_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_n_impl_2( + InputIterator first, + Size n, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_n_impl_2( + InputIterator first, + Size n, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return n != 0 && sizeof...(Args) < static_cast(offset) + ? copy_n_impl_2(sprout::next(first), n - 1, result, offset, args..., *first) + : copy_n_impl_3(result, args...) + ; + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_n_impl_1( + InputIterator first, + Size n, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type copy_n_impl_1( + InputIterator first, + Size n, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sizeof...(Args) < static_cast(offset) + ? copy_n_impl_1(first, n, result, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) + : copy_n_impl_2(first, n, result, offset + sprout::size(result), args...) + ; + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_n_impl( + InputIterator first, + Size n, + Result const& result + ) + { + return copy_n_impl_1(first, n, result, sprout::fixed_begin_offset(result)); + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_n( + InputIterator first, + Size n, + Result const& result, + void* + ) + { + return sprout::fixed::detail::copy_n_impl( + first, + n, + result + ); + } + } // namespace detail // // copy_n // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type copy_n( - Iterator first, + InputIterator first, Size n, Result const& result ) { - return sprout::fixed::copy( + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::copy_n( first, - sprout::next(first, n), - result + n, + result, + category() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/merge.hpp b/sprout/algorithm/fixed/merge.hpp index b76a4165..c991785c 100644 --- a/sprout/algorithm/fixed/merge.hpp +++ b/sprout/algorithm/fixed/merge.hpp @@ -34,15 +34,15 @@ namespace sprout { { return merge_impl_3(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 merge_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -51,15 +51,15 @@ 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 merge_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -79,15 +79,15 @@ namespace sprout { : merge_impl_3(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 merge_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -96,15 +96,15 @@ 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 merge_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -116,12 +116,12 @@ namespace sprout { : merge_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type merge_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -132,12 +132,12 @@ namespace sprout { // // merge // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type merge( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -154,12 +154,12 @@ namespace sprout { // // merge // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type merge( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fixed/partition_copy.hpp b/sprout/algorithm/fixed/partition_copy.hpp index d978c907..b7659ce0 100644 --- a/sprout/algorithm/fixed/partition_copy.hpp +++ b/sprout/algorithm/fixed/partition_copy.hpp @@ -33,13 +33,13 @@ namespace sprout { { return partition_copy_impl_3(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 partition_copy_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -48,13 +48,13 @@ 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 partition_copy_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -68,13 +68,13 @@ namespace sprout { : partition_copy_impl_3(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 partition_copy_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -83,13 +83,13 @@ 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 partition_copy_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -101,10 +101,10 @@ namespace sprout { : partition_copy_impl_2(first, last, result, pred, offset + sprout::size(result), args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type partition_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) @@ -115,10 +115,10 @@ namespace sprout { // // partition_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type partition_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) diff --git a/sprout/algorithm/fixed/remove_copy.hpp b/sprout/algorithm/fixed/remove_copy.hpp index 3d5ac7e6..a3688814 100644 --- a/sprout/algorithm/fixed/remove_copy.hpp +++ b/sprout/algorithm/fixed/remove_copy.hpp @@ -33,13 +33,13 @@ namespace sprout { { return remove_copy_impl_3(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 remove_copy_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& value, typename sprout::fixed_container_traits::difference_type offset, @@ -48,13 +48,13 @@ 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 remove_copy_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& value, typename sprout::fixed_container_traits::difference_type offset, @@ -68,13 +68,13 @@ namespace sprout { : remove_copy_impl_3(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 remove_copy_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& value, typename sprout::fixed_container_traits::difference_type offset, @@ -83,13 +83,13 @@ 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 remove_copy_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& value, typename sprout::fixed_container_traits::difference_type offset, @@ -101,10 +101,10 @@ namespace sprout { : remove_copy_impl_2(first, last, result, value, offset + sprout::size(result), args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type remove_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& value ) @@ -115,10 +115,10 @@ namespace sprout { // // remove_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type remove_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& value ) diff --git a/sprout/algorithm/fixed/remove_copy_if.hpp b/sprout/algorithm/fixed/remove_copy_if.hpp index a86541b4..74479257 100644 --- a/sprout/algorithm/fixed/remove_copy_if.hpp +++ b/sprout/algorithm/fixed/remove_copy_if.hpp @@ -33,13 +33,13 @@ namespace sprout { { return remove_copy_if_impl_3(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 remove_copy_if_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -48,13 +48,13 @@ 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 remove_copy_if_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -68,13 +68,13 @@ namespace sprout { : remove_copy_if_impl_3(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 remove_copy_if_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -83,13 +83,13 @@ 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 remove_copy_if_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -101,10 +101,10 @@ namespace sprout { : remove_copy_if_impl_2(first, last, result, pred, offset + sprout::size(result), args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type remove_copy_if_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) @@ -115,10 +115,10 @@ namespace sprout { // // remove_copy_if // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type remove_copy_if( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) diff --git a/sprout/algorithm/fixed/replace_copy.hpp b/sprout/algorithm/fixed/replace_copy.hpp index 56e513fe..0a51f9ce 100644 --- a/sprout/algorithm/fixed/replace_copy.hpp +++ b/sprout/algorithm/fixed/replace_copy.hpp @@ -2,21 +2,23 @@ #define SPROUT_ALGORITHM_FIXED_REPLACE_COPY_HPP #include +#include +#include #include #include #include #include -#include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { namespace fixed { namespace detail { - template - SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_impl( - Iterator first, - Iterator last, + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_impl_ra( + RandomAccessIterator first, + RandomAccessIterator last, Result const& result, sprout::index_tuple, T const& old_value, @@ -35,29 +37,170 @@ namespace sprout { )... ); } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy( + RandomAccessIterator first, + RandomAccessIterator last, + Result const& result, + T const& old_value, + T const& new_value, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::replace_copy_impl_ra( + first, + last, + result, + typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), + old_value, + new_value, + sprout::fixed_begin_offset(result), + sprout::size(result), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_impl_3( + Result const& result, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_impl_3( + Result const& result, + Args const&... args + ) + { + return replace_copy_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_impl_2( + InputIterator first, + InputIterator last, + Result const& result, + T const& old_value, + T const& new_value, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_impl_2( + InputIterator first, + InputIterator last, + Result const& result, + T const& old_value, + T const& new_value, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return first != last && sizeof...(Args) < static_cast(offset) + ? replace_copy_impl_2(sprout::next(first), last, result, old_value, new_value, offset, args..., *first == old_value ? new_value : *first) + : replace_copy_impl_3(result, args...) + ; + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_impl_1( + InputIterator first, + InputIterator last, + Result const& result, + T const& old_value, + T const& new_value, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_impl_1( + InputIterator first, + InputIterator last, + Result const& result, + T const& old_value, + T const& new_value, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sizeof...(Args) < static_cast(offset) + ? replace_copy_impl_1(first, last, result, old_value, new_value, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) + : replace_copy_impl_2(first, last, result, old_value, new_value, offset + sprout::size(result), args...) + ; + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_impl( + InputIterator first, + InputIterator last, + Result const& result, + T const& old_value, + T const& new_value + ) + { + return replace_copy_impl_1(first, last, result, old_value, new_value, sprout::fixed_begin_offset(result)); + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy( + InputIterator first, + InputIterator last, + Result const& result, + T const& old_value, + T const& new_value, + void* + ) + { + return sprout::fixed::detail::replace_copy_impl( + first, + last, + result, + old_value, + new_value + ); + } } // namespace detail // // replace_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, T const& old_value, T const& new_value ) { - return sprout::fixed::detail::replace_copy_impl( + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::replace_copy( first, last, result, - typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), old_value, new_value, - sprout::fixed_begin_offset(result), - sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + category() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/replace_copy_if.hpp b/sprout/algorithm/fixed/replace_copy_if.hpp index 6d417d1a..583fa08e 100644 --- a/sprout/algorithm/fixed/replace_copy_if.hpp +++ b/sprout/algorithm/fixed/replace_copy_if.hpp @@ -2,21 +2,23 @@ #define SPROUT_ALGORITHM_FIXED_REPLACE_COPY_IF_HPP #include +#include +#include #include #include #include #include -#include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { namespace fixed { namespace detail { - template - SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_if_impl( - Iterator first, - Iterator last, + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_if_impl_ra( + RandomAccessIterator first, + RandomAccessIterator last, Result const& result, sprout::index_tuple, Predicate pred, @@ -35,29 +37,170 @@ namespace sprout { )... ); } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_if( + RandomAccessIterator first, + RandomAccessIterator last, + Result const& result, + Predicate pred, + T const& new_value, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::replace_copy_if_impl_ra( + first, + last, + result, + typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), + pred, + new_value, + sprout::fixed_begin_offset(result), + sprout::size(result), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_if_impl_3( + Result const& result, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_if_impl_3( + Result const& result, + Args const&... args + ) + { + return replace_copy_if_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_if_impl_2( + InputIterator first, + InputIterator last, + Result const& result, + Predicate pred, + T const& new_value, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_if_impl_2( + InputIterator first, + InputIterator last, + Result const& result, + Predicate pred, + T const& new_value, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return first != last && sizeof...(Args) < static_cast(offset) + ? replace_copy_if_impl_2(sprout::next(first), last, result, pred, new_value, offset, args..., pred(*first) ? new_value : *first) + : replace_copy_if_impl_3(result, args...) + ; + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_if_impl_1( + InputIterator first, + InputIterator last, + Result const& result, + Predicate pred, + T const& new_value, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type replace_copy_if_impl_1( + InputIterator first, + InputIterator last, + Result const& result, + Predicate pred, + T const& new_value, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sizeof...(Args) < static_cast(offset) + ? replace_copy_if_impl_1(first, last, result, pred, new_value, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) + : replace_copy_if_impl_2(first, last, result, pred, new_value, offset + sprout::size(result), args...) + ; + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_if_impl( + InputIterator first, + InputIterator last, + Result const& result, + Predicate pred, + T const& new_value + ) + { + return replace_copy_if_impl_1(first, last, result, pred, new_value, sprout::fixed_begin_offset(result)); + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_if( + InputIterator first, + InputIterator last, + Result const& result, + Predicate pred, + T const& new_value, + void* + ) + { + return sprout::fixed::detail::replace_copy_if_impl( + first, + last, + result, + pred, + new_value + ); + } } // namespace detail // // replace_copy_if // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type replace_copy_if( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, T const& new_value ) { - return sprout::fixed::detail::replace_copy_if_impl( + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::replace_copy_if( first, last, result, - typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), pred, new_value, - sprout::fixed_begin_offset(result), - sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + category() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/reverse_copy.hpp b/sprout/algorithm/fixed/reverse_copy.hpp index 2298dede..6b5c3b5c 100644 --- a/sprout/algorithm/fixed/reverse_copy.hpp +++ b/sprout/algorithm/fixed/reverse_copy.hpp @@ -2,23 +2,23 @@ #define SPROUT_ALGORITHM_FIXED_REVERSE_COPY_HPP #include +#include +#include #include #include #include #include #include #include -#include -#include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { namespace fixed { namespace detail { - template - SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type reverse_copy_impl( - Iterator first, - Iterator last, + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type reverse_copy_impl_ra( + RandomAccessIterator first, + RandomAccessIterator last, Result const& result, sprout::index_tuple, typename sprout::fixed_container_traits::difference_type offset, @@ -35,25 +35,148 @@ namespace sprout { )... ); } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type reverse_copy( + RandomAccessIterator first, + RandomAccessIterator last, + Result const& result, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::reverse_copy_impl_ra( + first, + last, + result, + typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), + sprout::fixed_begin_offset(result), + sprout::size(result), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type reverse_copy_impl_3( + Result const& result, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type reverse_copy_impl_3( + Result const& result, + Args const&... args + ) + { + return reverse_copy_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type reverse_copy_impl_2( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type reverse_copy_impl_2( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return first != last && sizeof...(Args) < static_cast(offset) + ? reverse_copy_impl_2(first, sprout::prev(last), result, offset, args..., *sprout::prev(last)) + : reverse_copy_impl_3(result, args...) + ; + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type reverse_copy_impl_1( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type reverse_copy_impl_1( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sizeof...(Args) < static_cast(offset) + ? reverse_copy_impl_1(first, last, result, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) + : reverse_copy_impl_2(first, last, result, offset + sprout::size(result), args...) + ; + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type reverse_copy_impl( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result + ) + { + return reverse_copy_impl_1(first, last, result, sprout::fixed_begin_offset(result)); + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type reverse_copy( + BidirectionalIterator first, + BidirectionalIterator last, + Result const& result, + void* + ) + { + return sprout::fixed::detail::reverse_copy_impl( + first, + last, + result + ); + } } // namespace detail // // reverse_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type reverse_copy( - Iterator first, - Iterator last, + BidirectionalIterator first, + BidirectionalIterator last, Result const& result ) { - return sprout::fixed::detail::reverse_copy_impl( + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::reverse_copy( first, last, result, - typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), - sprout::fixed_begin_offset(result), - sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + category() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/rotate_copy.hpp b/sprout/algorithm/fixed/rotate_copy.hpp index b6aecb37..46e4a4b3 100644 --- a/sprout/algorithm/fixed/rotate_copy.hpp +++ b/sprout/algorithm/fixed/rotate_copy.hpp @@ -2,6 +2,8 @@ #define SPROUT_ALGORITHM_FIXED_ROTATE_COPY_HPP #include +#include +#include #include #include #include @@ -13,11 +15,11 @@ namespace sprout { namespace fixed { namespace detail { - template - SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type rotate_copy_impl( - Iterator first, - Iterator middle, - Iterator last, + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type rotate_copy_impl_ra( + RandomAccessIterator first, + RandomAccessIterator middle, + RandomAccessIterator last, Result const& result, sprout::index_tuple, typename sprout::fixed_container_traits::difference_type offset, @@ -37,27 +39,192 @@ namespace sprout { )... ); } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type rotate_copy( + RandomAccessIterator first, + RandomAccessIterator middle, + RandomAccessIterator last, + Result const& result, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::rotate_copy_impl_ra( + first, + middle, + last, + result, + typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), + sprout::fixed_begin_offset(result), + sprout::size(result), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type rotate_copy_impl_4( + Result const& result, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type rotate_copy_impl_4( + Result const& result, + Args const&... args + ) + { + return rotate_copy_impl_4(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type rotate_copy_impl_3( + ForwardIterator first, + ForwardIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type rotate_copy_impl_3( + ForwardIterator first, + ForwardIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return first != last && sizeof...(Args) < static_cast(offset) + ? rotate_copy_impl_3(sprout::next(first), last, result, offset, args..., *first) + : rotate_copy_impl_4(result, args...) + ; + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type rotate_copy_impl_2( + ForwardIterator first, + ForwardIterator middle, + ForwardIterator middle_first, + ForwardIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type rotate_copy_impl_2( + ForwardIterator first, + ForwardIterator middle, + ForwardIterator middle_first, + ForwardIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return middle_first != last && sizeof...(Args) < static_cast(offset) + ? rotate_copy_impl_2(first, middle, sprout::next(middle_first), last, result, offset, args..., *middle_first) + : rotate_copy_impl_3(first, middle, result, offset, args...) + ; + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type rotate_copy_impl_1( + ForwardIterator first, + ForwardIterator middle, + ForwardIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type rotate_copy_impl_1( + ForwardIterator first, + ForwardIterator middle, + ForwardIterator last, + Result const& result, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sizeof...(Args) < static_cast(offset) + ? rotate_copy_impl_1(first, middle, last, result, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) + : rotate_copy_impl_2(first, middle, middle, last, result, offset + sprout::size(result), args...) + ; + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type rotate_copy_impl( + ForwardIterator first, + ForwardIterator middle, + ForwardIterator last, + Result const& result + ) + { + return rotate_copy_impl_1(first, middle, last, result, sprout::fixed_begin_offset(result)); + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type rotate_copy( + ForwardIterator first, + ForwardIterator middle, + ForwardIterator last, + Result const& result, + void* + ) + { + return sprout::fixed::detail::rotate_copy_impl( + first, + middle, + last, + result + ); + } } // namespace detail // // rotate_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type rotate_copy( - Iterator first, - Iterator middle, - Iterator last, + ForwardIterator first, + ForwardIterator middle, + ForwardIterator last, Result const& result ) { - return sprout::fixed::detail::rotate_copy_impl( + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::rotate_copy( first, middle, last, result, - typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), - sprout::fixed_begin_offset(result), - sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + category() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/set_difference.hpp b/sprout/algorithm/fixed/set_difference.hpp index d18d9147..4c2c841d 100644 --- a/sprout/algorithm/fixed/set_difference.hpp +++ b/sprout/algorithm/fixed/set_difference.hpp @@ -34,15 +34,15 @@ namespace sprout { { return set_difference_impl_3(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 set_difference_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -51,15 +51,15 @@ 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 set_difference_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -81,15 +81,15 @@ namespace sprout { : set_difference_impl_3(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 set_difference_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -98,15 +98,15 @@ 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 set_difference_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -118,12 +118,12 @@ namespace sprout { : set_difference_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_difference_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -134,12 +134,12 @@ namespace sprout { // // set_difference // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_difference( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -156,12 +156,12 @@ namespace sprout { // // set_difference // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_difference( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fixed/set_intersection.hpp b/sprout/algorithm/fixed/set_intersection.hpp index c119e409..074ffdaa 100644 --- a/sprout/algorithm/fixed/set_intersection.hpp +++ b/sprout/algorithm/fixed/set_intersection.hpp @@ -34,15 +34,15 @@ namespace sprout { { return set_intersection_impl_3(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 set_intersection_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -51,15 +51,15 @@ 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 set_intersection_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -81,15 +81,15 @@ namespace sprout { : set_intersection_impl_3(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 set_intersection_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -98,15 +98,15 @@ 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 set_intersection_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -118,12 +118,12 @@ namespace sprout { : set_intersection_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_intersection_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -134,12 +134,12 @@ namespace sprout { // // set_intersection // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_intersection( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -156,12 +156,12 @@ namespace sprout { // // set_intersection // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_intersection( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fixed/set_symmetric_difference.hpp b/sprout/algorithm/fixed/set_symmetric_difference.hpp index aac67901..814c1e9f 100644 --- a/sprout/algorithm/fixed/set_symmetric_difference.hpp +++ b/sprout/algorithm/fixed/set_symmetric_difference.hpp @@ -34,15 +34,15 @@ namespace sprout { { return set_symmetric_difference_impl_3(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 set_symmetric_difference_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -51,15 +51,15 @@ 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 set_symmetric_difference_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -81,15 +81,15 @@ namespace sprout { : set_symmetric_difference_impl_3(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 set_symmetric_difference_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -98,15 +98,15 @@ 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 set_symmetric_difference_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -118,12 +118,12 @@ namespace sprout { : set_symmetric_difference_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_symmetric_difference_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -134,12 +134,12 @@ namespace sprout { // // set_symmetric_difference // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_symmetric_difference( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -156,12 +156,12 @@ namespace sprout { // // set_symmetric_difference // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_symmetric_difference( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fixed/set_union.hpp b/sprout/algorithm/fixed/set_union.hpp index 303755d3..03195be9 100644 --- a/sprout/algorithm/fixed/set_union.hpp +++ b/sprout/algorithm/fixed/set_union.hpp @@ -34,15 +34,15 @@ namespace sprout { { return set_union_impl_3(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 set_union_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -51,15 +51,15 @@ 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 set_union_impl_2( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -81,15 +81,15 @@ namespace sprout { : set_union_impl_3(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 set_union_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -98,15 +98,15 @@ 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 set_union_impl_1( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp, typename sprout::fixed_container_traits::difference_type offset, @@ -118,12 +118,12 @@ namespace sprout { : set_union_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_union_impl( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -134,12 +134,12 @@ namespace sprout { // // set_union // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_union( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result, Compare comp ) @@ -156,12 +156,12 @@ namespace sprout { // // set_union // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type set_union( - Iterator1 first1, - Iterator1 last1, - Iterator2 first2, - Iterator2 last2, + InputIterator1 first1, + InputIterator1 last1, + InputIterator2 first2, + InputIterator2 last2, Result const& result ) { diff --git a/sprout/algorithm/fixed/stable_partition_copy.hpp b/sprout/algorithm/fixed/stable_partition_copy.hpp index f985f21e..172e7e6d 100644 --- a/sprout/algorithm/fixed/stable_partition_copy.hpp +++ b/sprout/algorithm/fixed/stable_partition_copy.hpp @@ -34,13 +34,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( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -49,13 +49,13 @@ 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( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -70,33 +70,33 @@ 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( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, - Iterator origin, + InputIterator 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( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, - Iterator origin, + InputIterator origin, Args const&... args ) { @@ -107,33 +107,33 @@ namespace sprout { : 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( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, - Iterator origin, + InputIterator 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( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred, typename sprout::fixed_container_traits::difference_type offset, - Iterator origin, + InputIterator origin, Args const&... args ) { @@ -142,10 +142,10 @@ namespace sprout { : 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( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) @@ -156,10 +156,10 @@ namespace sprout { // // stable_partition_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type stable_partition_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, Predicate pred ) diff --git a/sprout/algorithm/fixed/swap_element_copy.hpp b/sprout/algorithm/fixed/swap_element_copy.hpp index d23853b0..a32b636f 100644 --- a/sprout/algorithm/fixed/swap_element_copy.hpp +++ b/sprout/algorithm/fixed/swap_element_copy.hpp @@ -2,25 +2,27 @@ #define SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_COPY_HPP #include +#include +#include #include #include #include #include -#include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { namespace fixed { namespace detail { - template - SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type swap_element_copy_impl( - Iterator first, - Iterator last, + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type swap_element_copy_impl_ra( + RandomAccessIterator first, + RandomAccessIterator last, Result const& result, sprout::index_tuple, - Iterator pos1, - Iterator pos2, + RandomAccessIterator pos1, + RandomAccessIterator pos2, typename sprout::fixed_container_traits::difference_type offset, typename sprout::fixed_container_traits::size_type size, typename sprout::fixed_container_traits::size_type input_size @@ -39,29 +41,168 @@ namespace sprout { )... ); } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type swap_element_copy( + RandomAccessIterator first, + RandomAccessIterator last, + Result const& result, + RandomAccessIterator pos1, + RandomAccessIterator pos2, + std::random_access_iterator_tag* + ) + { + return sprout::fixed::detail::swap_element_copy_impl_ra( + first, + last, + result, + typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), + pos1, + pos2, + sprout::fixed_begin_offset(result), + sprout::size(result), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + ); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type swap_element_copy_impl_3( + Result const& result, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type swap_element_copy_impl_3( + Result const& result, + Args const&... args + ) + { + return swap_element_copy_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type swap_element_copy_impl_2( + InputIterator first, + InputIterator last, + Result const& result, + InputIterator pos1, + InputIterator pos2, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type swap_element_copy_impl_2( + InputIterator first, + InputIterator last, + Result const& result, + InputIterator pos1, + InputIterator pos2, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return first != last && sizeof...(Args) < static_cast(offset) + ? swap_element_copy_impl_2(sprout::next(first), last, result, pos1, pos2, offset, args..., first == pos1 ? *pos2 : first == pos2 ? *pos1 : *first) + : swap_element_copy_impl_3(result, args...) + ; + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size == sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type swap_element_copy_impl_1( + InputIterator first, + InputIterator last, + Result const& result, + InputIterator pos1, + InputIterator pos2, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sprout::remake_clone(result, sprout::size(result), args...); + } + template + SPROUT_CONSTEXPR inline typename std::enable_if< + sprout::fixed_container_traits::fixed_size != sizeof...(Args), + typename sprout::fixed::result_of::algorithm::type + >::type swap_element_copy_impl_1( + InputIterator first, + InputIterator last, + Result const& result, + InputIterator pos1, + InputIterator pos2, + typename sprout::fixed_container_traits::difference_type offset, + Args const&... args + ) + { + return sizeof...(Args) < static_cast(offset) + ? swap_element_copy_impl_1(first, last, result, pos1, pos2, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) + : swap_element_copy_impl_2(first, last, result, pos1, pos2, offset + sprout::size(result), args...) + ; + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type swap_element_copy_impl( + InputIterator first, + InputIterator last, + Result const& result, + InputIterator pos1, + InputIterator pos2 + ) + { + return swap_element_copy_impl_1(first, last, result, pos1, pos2, pos1, pos2, sprout::fixed_begin_offset(result)); + } + template + SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type swap_element_copy( + InputIterator first, + InputIterator last, + Result const& result, + InputIterator pos1, + InputIterator pos2, + void* + ) + { + return sprout::fixed::detail::swap_element_copy_impl( + first, + last, + result + ); + } } // namespace detail // // swap_element_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type swap_element_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, - Iterator pos1, - Iterator pos2 + InputIterator pos1, + InputIterator pos2 ) { - return sprout::fixed::detail::swap_element_copy_impl( + typedef typename std::iterator_traits::iterator_category* category; + return sprout::fixed::detail::swap_element_copy( first, last, result, - typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), pos1, pos2, - sprout::fixed_begin_offset(result), - sprout::size(result), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) + category() ); } } // namespace fixed diff --git a/sprout/algorithm/fixed/unique_copy.hpp b/sprout/algorithm/fixed/unique_copy.hpp index 44427e4a..42b1bb34 100644 --- a/sprout/algorithm/fixed/unique_copy.hpp +++ b/sprout/algorithm/fixed/unique_copy.hpp @@ -33,13 +33,13 @@ namespace sprout { { return unique_copy_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); } - template + template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size == sizeof...(Args) + 1, typename sprout::fixed::result_of::algorithm::type >::type unique_copy_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset, Head const& head, @@ -48,13 +48,13 @@ 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) + 1, typename sprout::fixed::result_of::algorithm::type >::type unique_copy_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset, Head const& head, @@ -63,18 +63,18 @@ namespace sprout { { return first != last && sizeof...(Args) + 1 < offset ? !(head == *first) - ? unique_copy_impl_2(first + 1, last, result, offset, *first, args..., head) - : unique_copy_impl_2(first + 1, last, result, offset, head, args...) + ? 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...) : unique_copy_impl_3(result, args..., head) ; } - 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 unique_copy_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset, Args const&... args @@ -82,13 +82,13 @@ 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 unique_copy_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, typename sprout::fixed_container_traits::difference_type offset, Args const&... args @@ -96,13 +96,13 @@ namespace sprout { { return sizeof...(Args) < offset ? unique_copy_impl_1(first, last, result, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) - : unique_copy_impl_2(first + 1, last, result, offset + sprout::size(result), *first, args...) + : unique_copy_impl_2(sprout::next(first), last, result, offset + sprout::size(result), *first, args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type unique_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result ) { @@ -112,10 +112,10 @@ namespace sprout { // // unique_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type unique_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result ) { @@ -123,13 +123,13 @@ namespace sprout { } namespace detail { - template + template SPROUT_CONSTEXPR inline typename std::enable_if< sprout::fixed_container_traits::fixed_size == sizeof...(Args) + 1, typename sprout::fixed::result_of::algorithm::type >::type unique_copy_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, BinaryPredicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -139,13 +139,13 @@ 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) + 1, typename sprout::fixed::result_of::algorithm::type >::type unique_copy_impl_2( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, BinaryPredicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -155,18 +155,18 @@ namespace sprout { { return first != last && sizeof...(Args) + 1 < offset ? !pred(head, *first) - ? unique_copy_impl_2(first + 1, last, result, pred, offset, *first, args..., head) - : unique_copy_impl_2(first + 1, last, result, pred, offset, head, args...) + ? 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...) : unique_copy_impl_3(result, args..., head) ; } - 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 unique_copy_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, BinaryPredicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -175,13 +175,13 @@ 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 unique_copy_impl_1( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, BinaryPredicate pred, typename sprout::fixed_container_traits::difference_type offset, @@ -190,13 +190,13 @@ namespace sprout { { return sizeof...(Args) < offset ? unique_copy_impl_1(first, last, result, pred, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) - : unique_copy_impl_2(first + 1, last, result, pred, offset + sprout::size(result), *first, args...) + : unique_copy_impl_2(sprout::next(first), last, result, pred, offset + sprout::size(result), *first, args...) ; } - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type unique_copy_impl( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, BinaryPredicate pred ) @@ -207,10 +207,10 @@ namespace sprout { // // unique_copy // - template + template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type unique_copy( - Iterator first, - Iterator last, + InputIterator first, + InputIterator last, Result const& result, BinaryPredicate pred )