アルゴリズムのイテレータ要件を標準に準拠

This commit is contained in:
bolero-MURAKAMI 2011-10-07 16:40:45 +09:00
parent 6ae26b7470
commit 304c656b78
36 changed files with 1554 additions and 585 deletions

View file

@ -13,10 +13,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset
)
@ -31,10 +31,10 @@ namespace sprout {
//
// copy
//
template<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result
)
{

View file

@ -13,32 +13,32 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result>
template<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_backward_impl(
Iterator first,
Iterator last,
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::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<typename Iterator, typename Result>
template<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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

View file

@ -12,10 +12,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_if_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset
@ -31,10 +31,10 @@ namespace sprout {
//
// copy_if
//
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_if(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred
)

View file

@ -12,9 +12,9 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Size, typename Result>
template<typename InputIterator, typename Size, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_n_impl(
Iterator first,
InputIterator first,
Size n,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset
@ -30,9 +30,9 @@ namespace sprout {
//
// copy_n
//
template<typename Iterator, typename Size, typename Result>
template<typename InputIterator, typename Size, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_n(
Iterator first,
InputIterator first,
Size n,
Result const& result
)

View file

@ -13,12 +13,12 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
@ -37,12 +37,12 @@ namespace sprout {
//
// merge
//
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
)
@ -74,12 +74,12 @@ namespace sprout {
//
// merge
//
template<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type merge(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -12,10 +12,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type partition_copy_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset
@ -31,10 +31,10 @@ namespace sprout {
//
// partition_copy
//
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type partition_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred
)

View file

@ -13,10 +13,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result, typename T>
template<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type remove_copy_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
T const& value,
typename sprout::fixed_container_traits<Result>::difference_type offset
@ -32,10 +32,10 @@ namespace sprout {
//
// remove_copy
//
template<typename Iterator, typename Result, typename T>
template<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type remove_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
T const& value
)

View file

@ -13,10 +13,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type remove_copy_if_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset
@ -32,10 +32,10 @@ namespace sprout {
//
// remove_copy_if
//
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type remove_copy_if(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred
)

View file

@ -13,10 +13,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result, typename T>
template<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename T>
template<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type replace_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
T const& old_value,
T const& new_value

View file

@ -13,10 +13,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result, typename T, typename Predicate>
template<typename InputIterator, typename Result, typename T, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename T, typename Predicate>
template<typename InputIterator, typename Result, typename T, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type replace_copy_if(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
T const& new_value

View file

@ -13,10 +13,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result>
template<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type reverse_copy_impl(
Iterator first,
Iterator last,
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset
)
@ -31,10 +31,10 @@ namespace sprout {
//
// reverse_copy
//
template<typename Iterator, typename Result>
template<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type reverse_copy(
Iterator first,
Iterator last,
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result
)
{

View file

@ -13,11 +13,11 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result>
template<typename ForwardIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type rotate_copy_impl(
Iterator first,
Iterator middle,
Iterator last,
ForwardIterator first,
ForwardIterator middle,
ForwardIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset
)
@ -32,11 +32,11 @@ namespace sprout {
//
// rotate_copy
//
template<typename Iterator, typename Result>
template<typename ForwardIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type rotate_copy(
Iterator first,
Iterator middle,
Iterator last,
ForwardIterator first,
ForwardIterator middle,
ForwardIterator last,
Result const& result
)
{

View file

@ -14,12 +14,12 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
@ -40,12 +40,12 @@ namespace sprout {
//
// set_difference
//
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
)
@ -79,12 +79,12 @@ namespace sprout {
//
// set_difference
//
template<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_difference(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -13,12 +13,12 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
@ -37,12 +37,12 @@ namespace sprout {
//
// set_intersection
//
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
)
@ -74,12 +74,12 @@ namespace sprout {
//
// set_intersection
//
template<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_intersection(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -14,12 +14,12 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
@ -41,12 +41,12 @@ namespace sprout {
//
// set_symmetric_difference
//
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
)
@ -81,12 +81,12 @@ namespace sprout {
//
// set_symmetric_difference
//
template<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_symmetric_difference(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -14,12 +14,12 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
@ -41,12 +41,12 @@ namespace sprout {
//
// set_union
//
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
)
@ -81,12 +81,12 @@ namespace sprout {
//
// set_union
//
template<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_union(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -12,10 +12,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type stable_partition_copy_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset
@ -31,10 +31,10 @@ namespace sprout {
//
// stable_partition_copy
//
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type stable_partition_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred
)

View file

@ -13,13 +13,13 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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<Result>::difference_type offset
)
{
@ -33,13 +33,13 @@ namespace sprout {
//
// swap_element_copy
//
template<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::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));

View file

@ -14,10 +14,10 @@
namespace sprout {
namespace fit {
namespace detail {
template<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type unique_copy_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset
)
@ -32,10 +32,10 @@ namespace sprout {
//
// unique_copy
//
template<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type unique_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result
)
{
@ -43,10 +43,10 @@ namespace sprout {
}
namespace detail {
template<typename Iterator, typename Result, typename BinaryPredicate>
template<typename InputIterator, typename Result, typename BinaryPredicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type unique_copy_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
BinaryPredicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset
@ -62,10 +62,10 @@ namespace sprout {
//
// unique_copy
//
template<typename Iterator, typename Result, typename BinaryPredicate>
template<typename InputIterator, typename Result, typename BinaryPredicate>
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type unique_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
BinaryPredicate pred
)

View file

@ -2,6 +2,8 @@
#define SPROUT_ALGORITHM_FIXED_COPY_BACKWARD_HPP
#include <cstddef>
#include <iterator>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/index_tuple.hpp>
#include <sprout/fixed_container/traits.hpp>
@ -13,10 +15,10 @@
namespace sprout {
namespace fixed {
namespace detail {
template<typename Iterator, typename Result, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_backward_impl(
Iterator first,
Iterator last,
template<typename RandomAccessIterator, typename Result, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_backward_impl_ra(
RandomAccessIterator first,
RandomAccessIterator last,
Result const& result,
sprout::index_tuple<Indexes...>,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -27,31 +29,154 @@ namespace sprout {
return sprout::remake_clone<Result, Result>(
result,
sprout::size(result),
(Indexes < offset && Indexes + size >= offset && Indexes + input_size >= offset
(Indexes < offset && Indexes + size >= static_cast<std::size_t>(offset) && Indexes + input_size >= static_cast<std::size_t>(offset)
? *sprout::next(last, Indexes - offset)
: *sprout::next(sprout::fixed_begin(result), Indexes)
)...
);
}
template<typename RandomAccessIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<Result>::fixed_size>::type(),
sprout::fixed_end_offset(result),
sprout::size(result),
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_backward_impl_3(
Result const& result,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_backward_impl_2(
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_backward_impl_2(
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return first != last && sizeof...(Args) < static_cast<std::size_t>(offset)
? copy_backward_impl_2(first, sprout::prev(last), result, offset, *sprout::prev(last), args...)
: copy_backward_impl_3(result, args...)
;
}
template<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_backward_impl_1(
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_backward_impl_1(
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sizeof...(Args) < static_cast<std::size_t>(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<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result>
template<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<BidirectionalIterator>::iterator_category* category;
return sprout::fixed::detail::copy_backward(
first,
last,
result,
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::fixed_size>::type(),
sprout::fixed_end_offset(result),
sprout::size(result),
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
category()
);
}
} // namespace fixed

View file

@ -1,6 +1,8 @@
#ifndef SPROUT_ALGORITHM_FIXED_COPY_N_HPP
#define SPROUT_ALGORITHM_FIXED_COPY_N_HPP
#include <iterator>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/fixed_container/traits.hpp>
#include <sprout/fixed_container/functions.hpp>
@ -10,20 +12,145 @@
namespace sprout {
namespace fixed {
namespace detail {
template<typename RandomAccessIterator, typename Size, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_n_impl_3(
Result const& result,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Size, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_n_impl_2(
InputIterator first,
Size n,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename InputIterator, typename Size, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_n_impl_2(
InputIterator first,
Size n,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return n != 0 && sizeof...(Args) < static_cast<std::size_t>(offset)
? copy_n_impl_2(sprout::next(first), n - 1, result, offset, args..., *first)
: copy_n_impl_3(result, args...)
;
}
template<typename InputIterator, typename Size, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_n_impl_1(
InputIterator first,
Size n,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename InputIterator, typename Size, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type copy_n_impl_1(
InputIterator first,
Size n,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sizeof...(Args) < static_cast<std::size_t>(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<typename InputIterator, typename Size, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Size, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Size, typename Result>
template<typename InputIterator, typename Size, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_n(
Iterator first,
InputIterator first,
Size n,
Result const& result
)
{
return sprout::fixed::copy(
typedef typename std::iterator_traits<InputIterator>::iterator_category* category;
return sprout::fixed::detail::copy_n(
first,
sprout::next(first, n),
result
n,
result,
category()
);
}
} // namespace fixed

View file

@ -34,15 +34,15 @@ namespace sprout {
{
return merge_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -51,15 +51,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -79,15 +79,15 @@ namespace sprout {
: merge_impl_3(result, args...)
;
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -96,15 +96,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -116,12 +116,12 @@ namespace sprout {
: merge_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...)
;
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type merge(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -33,13 +33,13 @@ namespace sprout {
{
return partition_copy_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type partition_copy_impl_2(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -48,13 +48,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type partition_copy_impl_2(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -68,13 +68,13 @@ namespace sprout {
: partition_copy_impl_3(result, args...)
;
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type partition_copy_impl_1(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -83,13 +83,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type partition_copy_impl_1(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -101,10 +101,10 @@ namespace sprout {
: partition_copy_impl_2(first, last, result, pred, offset + sprout::size(result), args...)
;
}
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type partition_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred
)

View file

@ -33,13 +33,13 @@ namespace sprout {
{
return remove_copy_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator, typename Result, typename T, typename... Args>
template<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -48,13 +48,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename T, typename... Args>
template<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -68,13 +68,13 @@ namespace sprout {
: remove_copy_impl_3(result, args...)
;
}
template<typename Iterator, typename Result, typename T, typename... Args>
template<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -83,13 +83,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename T, typename... Args>
template<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -101,10 +101,10 @@ namespace sprout {
: remove_copy_impl_2(first, last, result, value, offset + sprout::size(result), args...)
;
}
template<typename Iterator, typename Result, typename T>
template<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename T>
template<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
T const& value
)

View file

@ -33,13 +33,13 @@ namespace sprout {
{
return remove_copy_if_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -48,13 +48,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -68,13 +68,13 @@ namespace sprout {
: remove_copy_if_impl_3(result, args...)
;
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -83,13 +83,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -101,10 +101,10 @@ namespace sprout {
: remove_copy_if_impl_2(first, last, result, pred, offset + sprout::size(result), args...)
;
}
template<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy_if(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred
)

View file

@ -2,21 +2,23 @@
#define SPROUT_ALGORITHM_FIXED_REPLACE_COPY_HPP
#include <cstddef>
#include <iterator>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/index_tuple.hpp>
#include <sprout/fixed_container/traits.hpp>
#include <sprout/fixed_container/functions.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/fixed/result_of.hpp>
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
namespace sprout {
namespace fixed {
namespace detail {
template<typename Iterator, typename Result, typename T, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy_impl(
Iterator first,
Iterator last,
template<typename RandomAccessIterator, typename Result, typename T, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy_impl_ra(
RandomAccessIterator first,
RandomAccessIterator last,
Result const& result,
sprout::index_tuple<Indexes...>,
T const& old_value,
@ -35,29 +37,170 @@ namespace sprout {
)...
);
}
template<typename RandomAccessIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<Result>::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<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type replace_copy_impl_3(
Result const& result,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Args const&... args
)
{
return first != last && sizeof...(Args) < static_cast<std::size_t>(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<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Args const&... args
)
{
return sizeof...(Args) < static_cast<std::size_t>(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<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename T>
template<typename InputIterator, typename Result, typename T>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<InputIterator>::iterator_category* category;
return sprout::fixed::detail::replace_copy(
first,
last,
result,
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::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

View file

@ -2,21 +2,23 @@
#define SPROUT_ALGORITHM_FIXED_REPLACE_COPY_IF_HPP
#include <cstddef>
#include <iterator>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/index_tuple.hpp>
#include <sprout/fixed_container/traits.hpp>
#include <sprout/fixed_container/functions.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/fixed/result_of.hpp>
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
namespace sprout {
namespace fixed {
namespace detail {
template<typename Iterator, typename Result, typename T, std::ptrdiff_t... Indexes, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy_if_impl(
Iterator first,
Iterator last,
template<typename RandomAccessIterator, typename Result, typename T, typename Predicate, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy_if_impl_ra(
RandomAccessIterator first,
RandomAccessIterator last,
Result const& result,
sprout::index_tuple<Indexes...>,
Predicate pred,
@ -35,29 +37,170 @@ namespace sprout {
)...
);
}
template<typename RandomAccessIterator, typename Result, typename T, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<Result>::fixed_size>::type(),
pred,
new_value,
sprout::fixed_begin_offset(result),
sprout::size(result),
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type replace_copy_if_impl_3(
Result const& result,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Result, typename T, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename InputIterator, typename Result, typename T, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Args const&... args
)
{
return first != last && sizeof...(Args) < static_cast<std::size_t>(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<typename InputIterator, typename Result, typename T, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename InputIterator, typename Result, typename T, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Args const&... args
)
{
return sizeof...(Args) < static_cast<std::size_t>(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<typename InputIterator, typename Result, typename T, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Result, typename T, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename T, typename Predicate>
template<typename InputIterator, typename Result, typename T, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<InputIterator>::iterator_category* category;
return sprout::fixed::detail::replace_copy_if(
first,
last,
result,
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::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

View file

@ -2,23 +2,23 @@
#define SPROUT_ALGORITHM_FIXED_REVERSE_COPY_HPP
#include <cstddef>
#include <iterator>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/index_tuple.hpp>
#include <sprout/fixed_container/traits.hpp>
#include <sprout/fixed_container/functions.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/fixed/result_of.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/fixed/result_of.hpp>
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
namespace sprout {
namespace fixed {
namespace detail {
template<typename Iterator, typename Result, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type reverse_copy_impl(
Iterator first,
Iterator last,
template<typename RandomAccessIterator, typename Result, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type reverse_copy_impl_ra(
RandomAccessIterator first,
RandomAccessIterator last,
Result const& result,
sprout::index_tuple<Indexes...>,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -35,25 +35,148 @@ namespace sprout {
)...
);
}
template<typename RandomAccessIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<Result>::fixed_size>::type(),
sprout::fixed_begin_offset(result),
sprout::size(result),
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type reverse_copy_impl_3(
Result const& result,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type reverse_copy_impl_2(
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type reverse_copy_impl_2(
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return first != last && sizeof...(Args) < static_cast<std::size_t>(offset)
? reverse_copy_impl_2(first, sprout::prev(last), result, offset, args..., *sprout::prev(last))
: reverse_copy_impl_3(result, args...)
;
}
template<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type reverse_copy_impl_1(
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type reverse_copy_impl_1(
BidirectionalIterator first,
BidirectionalIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sizeof...(Args) < static_cast<std::size_t>(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<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result>
template<typename BidirectionalIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<BidirectionalIterator>::iterator_category* category;
return sprout::fixed::detail::reverse_copy(
first,
last,
result,
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::fixed_size>::type(),
sprout::fixed_begin_offset(result),
sprout::size(result),
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
category()
);
}
} // namespace fixed

View file

@ -2,6 +2,8 @@
#define SPROUT_ALGORITHM_FIXED_ROTATE_COPY_HPP
#include <cstddef>
#include <iterator>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/index_tuple.hpp>
#include <sprout/fixed_container/traits.hpp>
@ -13,11 +15,11 @@
namespace sprout {
namespace fixed {
namespace detail {
template<typename Iterator, typename Result, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type rotate_copy_impl(
Iterator first,
Iterator middle,
Iterator last,
template<typename RandomAccessIterator, typename Result, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type rotate_copy_impl_ra(
RandomAccessIterator first,
RandomAccessIterator middle,
RandomAccessIterator last,
Result const& result,
sprout::index_tuple<Indexes...>,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -37,27 +39,192 @@ namespace sprout {
)...
);
}
template<typename RandomAccessIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<Result>::fixed_size>::type(),
sprout::fixed_begin_offset(result),
sprout::size(result),
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type rotate_copy_impl_4(
Result const& result,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<typename ForwardIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type rotate_copy_impl_3(
ForwardIterator first,
ForwardIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename ForwardIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type rotate_copy_impl_3(
ForwardIterator first,
ForwardIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return first != last && sizeof...(Args) < static_cast<std::size_t>(offset)
? rotate_copy_impl_3(sprout::next(first), last, result, offset, args..., *first)
: rotate_copy_impl_4(result, args...)
;
}
template<typename ForwardIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type rotate_copy_impl_2(
ForwardIterator first,
ForwardIterator middle,
ForwardIterator middle_first,
ForwardIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename ForwardIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type rotate_copy_impl_2(
ForwardIterator first,
ForwardIterator middle,
ForwardIterator middle_first,
ForwardIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return middle_first != last && sizeof...(Args) < static_cast<std::size_t>(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<typename ForwardIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type rotate_copy_impl_1(
ForwardIterator first,
ForwardIterator middle,
ForwardIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename ForwardIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type rotate_copy_impl_1(
ForwardIterator first,
ForwardIterator middle,
ForwardIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sizeof...(Args) < static_cast<std::size_t>(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<typename ForwardIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename ForwardIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result>
template<typename ForwardIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<ForwardIterator>::iterator_category* category;
return sprout::fixed::detail::rotate_copy(
first,
middle,
last,
result,
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::fixed_size>::type(),
sprout::fixed_begin_offset(result),
sprout::size(result),
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
category()
);
}
} // namespace fixed

View file

@ -34,15 +34,15 @@ namespace sprout {
{
return set_difference_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -51,15 +51,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -81,15 +81,15 @@ namespace sprout {
: set_difference_impl_3(result, args...)
;
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -98,15 +98,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_difference(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -34,15 +34,15 @@ namespace sprout {
{
return set_intersection_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -51,15 +51,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -81,15 +81,15 @@ namespace sprout {
: set_intersection_impl_3(result, args...)
;
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -98,15 +98,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_intersection(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -34,15 +34,15 @@ namespace sprout {
{
return set_symmetric_difference_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -51,15 +51,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -81,15 +81,15 @@ namespace sprout {
: set_symmetric_difference_impl_3(result, args...)
;
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -98,15 +98,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_symmetric_difference(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -34,15 +34,15 @@ namespace sprout {
{
return set_union_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -51,15 +51,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -81,15 +81,15 @@ namespace sprout {
: set_union_impl_3(result, args...)
;
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -98,15 +98,15 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator1, typename Iterator2, typename Result, typename Compare, typename... Args>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result, typename Compare>
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator1, typename Iterator2, typename Result>
template<typename InputIterator1, typename InputIterator2, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_union(
Iterator1 first1,
Iterator1 last1,
Iterator2 first2,
Iterator2 last2,
InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator2 last2,
Result const& result
)
{

View file

@ -34,13 +34,13 @@ namespace sprout {
return stable_partition_copy_impl_4(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args)));
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -49,13 +49,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
@ -70,33 +70,33 @@ namespace sprout {
;
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Iterator origin,
InputIterator origin,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::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<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::difference_type offset,
Iterator origin,
InputIterator origin,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename Predicate, typename... Args>
template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<Result>::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<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename Predicate>
template<typename InputIterator, typename Result, typename Predicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type stable_partition_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
Predicate pred
)

View file

@ -2,25 +2,27 @@
#define SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_COPY_HPP
#include <cstddef>
#include <iterator>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/index_tuple.hpp>
#include <sprout/fixed_container/traits.hpp>
#include <sprout/fixed_container/functions.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/fixed/result_of.hpp>
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
namespace sprout {
namespace fixed {
namespace detail {
template<typename Iterator, typename Result, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type swap_element_copy_impl(
Iterator first,
Iterator last,
template<typename RandomAccessIterator, typename Result, std::ptrdiff_t... Indexes>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type swap_element_copy_impl_ra(
RandomAccessIterator first,
RandomAccessIterator last,
Result const& result,
sprout::index_tuple<Indexes...>,
Iterator pos1,
Iterator pos2,
RandomAccessIterator pos1,
RandomAccessIterator pos2,
typename sprout::fixed_container_traits<Result>::difference_type offset,
typename sprout::fixed_container_traits<Result>::size_type size,
typename sprout::fixed_container_traits<Result>::size_type input_size
@ -39,29 +41,168 @@ namespace sprout {
)...
);
}
template<typename RandomAccessIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<Result>::fixed_size>::type(),
pos1,
pos2,
sprout::fixed_begin_offset(result),
sprout::size(result),
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type swap_element_copy_impl_3(
Result const& result,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type swap_element_copy_impl_2(
InputIterator first,
InputIterator last,
Result const& result,
InputIterator pos1,
InputIterator pos2,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type swap_element_copy_impl_2(
InputIterator first,
InputIterator last,
Result const& result,
InputIterator pos1,
InputIterator pos2,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return first != last && sizeof...(Args) < static_cast<std::size_t>(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<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type swap_element_copy_impl_1(
InputIterator first,
InputIterator last,
Result const& result,
InputIterator pos1,
InputIterator pos2,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type swap_element_copy_impl_1(
InputIterator first,
InputIterator last,
Result const& result,
InputIterator pos1,
InputIterator pos2,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
)
{
return sizeof...(Args) < static_cast<std::size_t>(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<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<InputIterator>::iterator_category* category;
return sprout::fixed::detail::swap_element_copy(
first,
last,
result,
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::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

View file

@ -33,13 +33,13 @@ namespace sprout {
{
return unique_copy_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
}
template<typename Iterator, typename Result, typename Head, typename... Args>
template<typename InputIterator, typename Result, typename Head, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args) + 1,
typename sprout::fixed::result_of::algorithm<Result>::type
>::type unique_copy_impl_2(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Head const& head,
@ -48,13 +48,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename Head, typename... Args>
template<typename InputIterator, typename Result, typename Head, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args) + 1,
typename sprout::fixed::result_of::algorithm<Result>::type
>::type unique_copy_impl_2(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::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<typename Iterator, typename Result, typename... Args>
template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type unique_copy_impl_1(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::difference_type offset,
Args const&... args
@ -82,13 +82,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename... Args>
template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type unique_copy_impl_1(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
typename sprout::fixed_container_traits<Result>::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<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type unique_copy_impl(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result
)
{
@ -112,10 +112,10 @@ namespace sprout {
//
// unique_copy
//
template<typename Iterator, typename Result>
template<typename InputIterator, typename Result>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type unique_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result
)
{
@ -123,13 +123,13 @@ namespace sprout {
}
namespace detail {
template<typename Iterator, typename Result, typename BinaryPredicate, typename Head, typename... Args>
template<typename InputIterator, typename Result, typename BinaryPredicate, typename Head, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args) + 1,
typename sprout::fixed::result_of::algorithm<Result>::type
>::type unique_copy_impl_2(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
BinaryPredicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -139,13 +139,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename BinaryPredicate, typename Head, typename... Args>
template<typename InputIterator, typename Result, typename BinaryPredicate, typename Head, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args) + 1,
typename sprout::fixed::result_of::algorithm<Result>::type
>::type unique_copy_impl_2(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
BinaryPredicate pred,
typename sprout::fixed_container_traits<Result>::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<typename Iterator, typename Result, typename BinaryPredicate, typename... Args>
template<typename InputIterator, typename Result, typename BinaryPredicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type unique_copy_impl_1(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
BinaryPredicate pred,
typename sprout::fixed_container_traits<Result>::difference_type offset,
@ -175,13 +175,13 @@ namespace sprout {
{
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
}
template<typename Iterator, typename Result, typename BinaryPredicate, typename... Args>
template<typename InputIterator, typename Result, typename BinaryPredicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if<
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
>::type unique_copy_impl_1(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
BinaryPredicate pred,
typename sprout::fixed_container_traits<Result>::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<typename Iterator, typename Result, typename BinaryPredicate>
template<typename InputIterator, typename Result, typename BinaryPredicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::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<typename Iterator, typename Result, typename BinaryPredicate>
template<typename InputIterator, typename Result, typename BinaryPredicate>
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type unique_copy(
Iterator first,
Iterator last,
InputIterator first,
InputIterator last,
Result const& result,
BinaryPredicate pred
)