From 48f1b2d615c38bb3a7fba8b88cefc72631c0b603 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Sun, 20 Jan 2013 20:49:37 +0900 Subject: [PATCH] add new signatures: some algorithms --- sprout/algorithm/fit.hpp | 2 +- sprout/algorithm/fixed.hpp | 2 +- sprout/algorithm/fixed/merge.hpp | 21 +++++++++++++++++++ sprout/algorithm/fixed/partition_copy.hpp | 12 +++++++---- sprout/algorithm/fixed/rotate_copy.hpp | 4 +--- sprout/algorithm/fixed/set_difference.hpp | 21 +++++++++++++++++++ sprout/algorithm/fixed/set_intersection.hpp | 21 +++++++++++++++++++ .../fixed/set_symmetric_difference.hpp | 21 +++++++++++++++++++ sprout/algorithm/fixed/set_union.hpp | 21 +++++++++++++++++++ .../algorithm/fixed/stable_partition_copy.hpp | 7 +++++++ sprout/algorithm/fixed/swap_element_copy.hpp | 7 +++++++ sprout/algorithm/fixed/unique_copy.hpp | 7 +++++++ 12 files changed, 137 insertions(+), 9 deletions(-) diff --git a/sprout/algorithm/fit.hpp b/sprout/algorithm/fit.hpp index 2450e0d0..6eb69c2c 100644 --- a/sprout/algorithm/fit.hpp +++ b/sprout/algorithm/fit.hpp @@ -54,8 +54,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/sprout/algorithm/fixed.hpp b/sprout/algorithm/fixed.hpp index 1f876455..b7619407 100644 --- a/sprout/algorithm/fixed.hpp +++ b/sprout/algorithm/fixed.hpp @@ -54,8 +54,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/sprout/algorithm/fixed/merge.hpp b/sprout/algorithm/fixed/merge.hpp index 167bb74e..771d84d3 100644 --- a/sprout/algorithm/fixed/merge.hpp +++ b/sprout/algorithm/fixed/merge.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT @@ -100,6 +101,26 @@ namespace sprout { sprout::size(result) ); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + merge( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Compare comp + ) + { + return sprout::fixed::merge(first1, last1, first2, last2, sprout::pit(), comp); + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + merge( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2 + ) + { + return sprout::fixed::merge(first1, last1, first2, last2, sprout::pit()); + } } // namespace fixed using sprout::fixed::merge; diff --git a/sprout/algorithm/fixed/partition_copy.hpp b/sprout/algorithm/fixed/partition_copy.hpp index 4ad4c5c2..e86ef1a5 100644 --- a/sprout/algorithm/fixed/partition_copy.hpp +++ b/sprout/algorithm/fixed/partition_copy.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace sprout { @@ -50,10 +51,13 @@ namespace sprout { template inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type partition_copy(InputIterator first, InputIterator last, Result const& result, Predicate pred) { - return sprout::fixed::detail::partition_copy_impl( - first, last, result, pred, - sprout::size(result) - ); + return sprout::fixed::detail::partition_copy_impl(first, last, result, pred, sprout::size(result)); + } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + partition_copy(InputIterator first, InputIterator last, Predicate pred) { + return sprout::fixed::partition_copy(first, last, sprout::pit(), pred); } } // namespace fixed diff --git a/sprout/algorithm/fixed/rotate_copy.hpp b/sprout/algorithm/fixed/rotate_copy.hpp index af7179e3..05862ec5 100644 --- a/sprout/algorithm/fixed/rotate_copy.hpp +++ b/sprout/algorithm/fixed/rotate_copy.hpp @@ -48,9 +48,7 @@ namespace sprout { ) { return sprout::fixed::detail::rotate_copy_impl_ra( - first, - middle, - last, + first, middle, last, result, sprout::index_range<0, sprout::container_traits::static_size>::make(), sprout::internal_begin_offset(result), diff --git a/sprout/algorithm/fixed/set_difference.hpp b/sprout/algorithm/fixed/set_difference.hpp index 6544b168..df2713fd 100644 --- a/sprout/algorithm/fixed/set_difference.hpp +++ b/sprout/algorithm/fixed/set_difference.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT @@ -105,6 +106,26 @@ namespace sprout { sprout::size(result) ); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + set_difference( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Compare comp + ) + { + return sprout::fixed::set_difference(first1, last1, first2, last2, sprout::pit(), comp); + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + set_difference( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2 + ) + { + return sprout::fixed::set_difference(first1, last1, first2, last2, sprout::pit()); + } } // namespace fixed using sprout::fixed::set_difference; diff --git a/sprout/algorithm/fixed/set_intersection.hpp b/sprout/algorithm/fixed/set_intersection.hpp index c86617f8..b81e4a3b 100644 --- a/sprout/algorithm/fixed/set_intersection.hpp +++ b/sprout/algorithm/fixed/set_intersection.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT @@ -105,6 +106,26 @@ namespace sprout { sprout::size(result) ); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + set_intersection( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Compare comp + ) + { + return sprout::fixed::set_intersection(first1, last1, first2, last2, sprout::pit(), comp); + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + set_intersection( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2 + ) + { + return sprout::fixed::set_intersection(first1, last1, first2, last2, sprout::pit()); + } } // namespace fixed using sprout::fixed::set_intersection; diff --git a/sprout/algorithm/fixed/set_symmetric_difference.hpp b/sprout/algorithm/fixed/set_symmetric_difference.hpp index 7a14f95c..46105b61 100644 --- a/sprout/algorithm/fixed/set_symmetric_difference.hpp +++ b/sprout/algorithm/fixed/set_symmetric_difference.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT @@ -105,6 +106,26 @@ namespace sprout { sprout::size(result) ); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + set_symmetric_difference( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Compare comp + ) + { + return sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, sprout::pit(), comp); + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + set_symmetric_difference( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2 + ) + { + return sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, sprout::pit()); + } } // namespace fixed using sprout::fixed::set_symmetric_difference; diff --git a/sprout/algorithm/fixed/set_union.hpp b/sprout/algorithm/fixed/set_union.hpp index df386106..9a33646d 100644 --- a/sprout/algorithm/fixed/set_union.hpp +++ b/sprout/algorithm/fixed/set_union.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT @@ -105,6 +106,26 @@ namespace sprout { sprout::size(result) ); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + set_union( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Compare comp + ) + { + return sprout::fixed::set_union(first1, last1, first2, last2, sprout::pit(), comp); + } + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + set_union( + InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2 + ) + { + return sprout::fixed::set_union(first1, last1, first2, last2, sprout::pit()); + } } // namespace fixed using sprout::fixed::set_union; diff --git a/sprout/algorithm/fixed/stable_partition_copy.hpp b/sprout/algorithm/fixed/stable_partition_copy.hpp index 02160ee2..9fb218ec 100644 --- a/sprout/algorithm/fixed/stable_partition_copy.hpp +++ b/sprout/algorithm/fixed/stable_partition_copy.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace sprout { @@ -105,6 +106,12 @@ namespace sprout { stable_partition_copy(BidirectionalIterator first, BidirectionalIterator last, Result const& result, Predicate pred) { return sprout::fixed::detail::stable_partition_copy_impl(first, last, result, pred, sprout::size(result), first); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + stable_partition_copy(BidirectionalIterator first, BidirectionalIterator last, Predicate pred) { + return sprout::fixed::stable_partition_copy(first, last, sprout::pit(), pred); + } } // namespace fixed using sprout::fixed::stable_partition_copy; diff --git a/sprout/algorithm/fixed/swap_element_copy.hpp b/sprout/algorithm/fixed/swap_element_copy.hpp index a94a9a02..c04b9ad1 100644 --- a/sprout/algorithm/fixed/swap_element_copy.hpp +++ b/sprout/algorithm/fixed/swap_element_copy.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace sprout { @@ -116,6 +117,12 @@ namespace sprout { typedef typename std::iterator_traits::iterator_category* category; return sprout::fixed::detail::swap_element_copy(first, last, result, pos1, pos2, category()); } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + swap_element_copy(ForwardIterator first, ForwardIterator last, ForwardIterator pos1, ForwardIterator pos2) { + return sprout::fixed::swap_element_copy(first, last, sprout::pit(), pos1, pos2); + } } // namespace fixed using sprout::fixed::swap_element_copy; diff --git a/sprout/algorithm/fixed/unique_copy.hpp b/sprout/algorithm/fixed/unique_copy.hpp index 39033daf..b38ccf87 100644 --- a/sprout/algorithm/fixed/unique_copy.hpp +++ b/sprout/algorithm/fixed/unique_copy.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace sprout { @@ -108,6 +109,12 @@ namespace sprout { : sprout::detail::container_complate(result) ; } + + template + inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm::type + unique_copy(InputIterator first, InputIterator last, BinaryPredicate pred) { + return sprout::fixed::unique_copy(first, last, sprout::pit(), pred); + } } // namespace fixed using sprout::fixed::unique_copy;