mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-05-10 09:23:30 +00:00
fized_size 修正
This commit is contained in:
parent
460327b419
commit
f7b354ec3f
303 changed files with 92 additions and 14607 deletions
|
@ -12,7 +12,7 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
struct fixed_size {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::size_type value
|
||||
SPROUT_STATIC_CONSTEXPR typename sprout::fixed_container_traits<Container>::size_type value
|
||||
= sprout::fixed_container_traits<Container>::fixed_size
|
||||
;
|
||||
typedef std::integral_constant<typename sprout::fixed_container_traits<Container>::size_type, value> type;
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef SPROUT_ADAPT_SSCRISK_CEL_ARRAY_HPP
|
||||
#define SPROUT_ADAPT_SSCRISK_CEL_ARRAY_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sscrisk/cel/array.hpp>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// rebind_fixed_size
|
||||
//
|
||||
template<typename T, std::size_t N>
|
||||
struct rebind_fixed_size<sscrisk::cel::array<T, N> > {
|
||||
public:
|
||||
template<typename sprout::fixed_container_traits<sscrisk::cel::array<T, N> >::size_type S>
|
||||
struct apply {
|
||||
public:
|
||||
typedef sscrisk::cel::array<T, S> type;
|
||||
};
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ADAPT_SSCRISK_CEL_ARRAY_HPP
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_HPP
|
||||
#define SPROUT_ALGORITHM_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed.hpp>
|
||||
#include <sprout/algorithm/fit.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_HPP
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy.hpp>
|
||||
#include <sprout/algorithm/fit/copy.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COPY_HPP
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_COPY_BACKWARD_HPP
|
||||
#define SPROUT_ALGORITHM_COPY_BACKWARD_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_backward.hpp>
|
||||
#include <sprout/algorithm/fit/copy_backward.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COPY_BACKWARD_HPP
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_COPY_IF_HPP
|
||||
#define SPROUT_ALGORITHM_COPY_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/copy_if.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COPY_IF_HPP
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_COPY_N_HPP
|
||||
#define SPROUT_ALGORITHM_COPY_N_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_n.hpp>
|
||||
#include <sprout/algorithm/fit/copy_n.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COPY_N_HPP
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FILL_HPP
|
||||
#define SPROUT_ALGORITHM_FILL_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/fill.hpp>
|
||||
#include <sprout/algorithm/fit/fill.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FILL_HPP
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FILL_N_HPP
|
||||
#define SPROUT_ALGORITHM_FILL_N_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/fill_n.hpp>
|
||||
#include <sprout/algorithm/fit/fill_n.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FILL_N_HPP
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fit/copy.hpp>
|
||||
#include <sprout/algorithm/fit/copy_n.hpp>
|
||||
#include <sprout/algorithm/fit/copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/copy_backward.hpp>
|
||||
#include <sprout/algorithm/fit/transform.hpp>
|
||||
#include <sprout/algorithm/fit/replace.hpp>
|
||||
#include <sprout/algorithm/fit/replace_if.hpp>
|
||||
#include <sprout/algorithm/fit/replace_copy.hpp>
|
||||
#include <sprout/algorithm/fit/replace_copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/fill.hpp>
|
||||
#include <sprout/algorithm/fit/fill_n.hpp>
|
||||
#include <sprout/algorithm/fit/generate.hpp>
|
||||
#include <sprout/algorithm/fit/generate_n.hpp>
|
||||
#include <sprout/algorithm/fit/remove.hpp>
|
||||
#include <sprout/algorithm/fit/remove_if.hpp>
|
||||
#include <sprout/algorithm/fit/remove_copy.hpp>
|
||||
#include <sprout/algorithm/fit/remove_copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/unique.hpp>
|
||||
#include <sprout/algorithm/fit/unique_copy.hpp>
|
||||
#include <sprout/algorithm/fit/reverse.hpp>
|
||||
#include <sprout/algorithm/fit/reverse_copy.hpp>
|
||||
#include <sprout/algorithm/fit/rotate.hpp>
|
||||
#include <sprout/algorithm/fit/rotate_copy.hpp>
|
||||
#include <sprout/algorithm/fit/partition.hpp>
|
||||
#include <sprout/algorithm/fit/partition_copy.hpp>
|
||||
#include <sprout/algorithm/fit/stable_partition.hpp>
|
||||
#include <sprout/algorithm/fit/stable_partition_copy.hpp>
|
||||
#include <sprout/algorithm/fit/sort.hpp>
|
||||
#include <sprout/algorithm/fit/stable_sort.hpp>
|
||||
#include <sprout/algorithm/fit/partial_sort.hpp>
|
||||
#include <sprout/algorithm/fit/nth_element.hpp>
|
||||
#include <sprout/algorithm/fit/merge.hpp>
|
||||
#include <sprout/algorithm/fit/inplace_merge.hpp>
|
||||
#include <sprout/algorithm/fit/set_union.hpp>
|
||||
#include <sprout/algorithm/fit/set_intersection.hpp>
|
||||
#include <sprout/algorithm/fit/set_difference.hpp>
|
||||
#include <sprout/algorithm/fit/set_symmetric_difference.hpp>
|
||||
#include <sprout/algorithm/fit/push_heap.hpp>
|
||||
#include <sprout/algorithm/fit/pop_heap.hpp>
|
||||
#include <sprout/algorithm/fit/make_heap.hpp>
|
||||
#include <sprout/algorithm/fit/make_partial_heap.hpp>
|
||||
#include <sprout/algorithm/fit/sort_heap.hpp>
|
||||
#include <sprout/algorithm/fit/swap_element.hpp>
|
||||
#include <sprout/algorithm/fit/swap_element_copy.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_HPP
|
|
@ -1,46 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::copy(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::copy_impl(first, last, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_COPY_HPP
|
|
@ -1,46 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_COPY_BACKWARD_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_COPY_BACKWARD_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_backward.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_backward_impl(
|
||||
Iterator first,
|
||||
Iterator 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))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// copy_backward
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_backward(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::copy_backward_impl(first, last, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_COPY_BACKWARD_HPP
|
|
@ -1,47 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_COPY_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_COPY_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_if_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::copy_if(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(first, last, pred), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// copy_if
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::copy_if_impl(first, last, result, pred, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_COPY_IF_HPP
|
|
@ -1,45 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_COPY_N_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_COPY_N_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_n.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Size, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_n_impl(
|
||||
Iterator first,
|
||||
Size n,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::copy_n(first, n, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n, sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// copy_n
|
||||
//
|
||||
template<typename Iterator, typename Size, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type copy_n(
|
||||
Iterator first,
|
||||
Size n,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::copy_n_impl(first, n, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_COPY_N_HPP
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_FILL_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_FILL_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/fill.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type fill_impl(
|
||||
Container const& cont,
|
||||
T const& value,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::fill(cont, value)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// fill
|
||||
//
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type fill(
|
||||
Container const& cont,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::fill_impl(cont, value, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_FILL_HPP
|
|
@ -1,45 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_FILL_N_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_FILL_N_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/fill_n.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Size, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type fill_n_impl(
|
||||
Container const& cont,
|
||||
Size n,
|
||||
T const& value,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::fill_n(cont, n, value)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n, sprout::size(cont))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// fill_n
|
||||
//
|
||||
template<typename Container, typename Size, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type fill_n(
|
||||
Container const& cont,
|
||||
Size n,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::fill_n_impl(cont, n, value, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_FILL_N_HPP
|
|
@ -1,44 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_GENERATE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_GENERATE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/generate.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type generate_impl(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
Inits const&... inits
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::generate(cont, gen, inits...)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// generate
|
||||
//
|
||||
template<typename Container, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type generate(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
Inits const&... inits
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::generate_impl(cont, gen, sprout::fixed_begin_offset(cont), inits...);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_GENERATE_HPP
|
|
@ -1,47 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_GENERATE_N_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_GENERATE_N_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/generate_n.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Size, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type generate_n_impl(
|
||||
Container const& cont,
|
||||
Size n,
|
||||
Generator gen,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
Inits const&... inits
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::generate_n(cont, n, gen, inits...)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n, sprout::size(cont))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// generate_n
|
||||
//
|
||||
template<typename Container, typename Size, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type generate_n(
|
||||
Container const& cont,
|
||||
Size n,
|
||||
Generator gen,
|
||||
Inits const&... inits
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::generate_n_impl(cont, n, gen, sprout::fixed_begin_offset(cont), inits...);
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_GENERATE_N_HPP
|
|
@ -1,71 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_INPLACE_MERGE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_INPLACE_MERGE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/inplace_merge.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type inplace_merge_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::inplace_merge(cont, middle, comp)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// inplace_merge
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type inplace_merge(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::inplace_merge_impl(cont, middle, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type inplace_merge_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::inplace_merge(cont, middle)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// inplace_merge
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type inplace_merge(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::inplace_merge_impl(cont, middle, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_INPLACE_MERGE_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_MAKE_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_MAKE_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/make_heap.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type make_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::make_heap(cont, comp)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// make_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type make_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::make_heap_impl(cont, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type make_heap_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::make_heap(cont)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// make_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type make_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::make_heap_impl(cont, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_MAKE_HEAP_HPP
|
|
@ -1,72 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_MAKE_PARTIAL_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_MAKE_PARTIAL_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/make_partial_heap.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type make_partial_heap_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::make_partial_heap(cont, middle, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// make_partial_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type make_partial_heap(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::make_partial_heap_impl(cont, middle, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type make_partial_heap_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::make_partial_heap(cont, middle)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// make_partial_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type make_partial_heap(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::make_partial_heap_impl(cont, middle, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_MAKE_PARTIAL_HEAP_HPP
|
|
@ -1,91 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_MERGE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_MERGE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/merge.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::merge(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2),
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// merge
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type merge(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::merge_impl(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type merge_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::merge(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1) + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2),
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// merge
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type merge(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::merge_impl(first1, last1, first2, last2, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_MERGE_HPP
|
|
@ -1,72 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_NTH_ELEMENT_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_NTH_ELEMENT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/nth_element.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type nth_element_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator nth,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::nth_element(cont, nth, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), nth) + 1
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// nth_element
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type nth_element(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator nth,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::nth_element_impl(cont, nth, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type nth_element_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator nth,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::nth_element(cont, nth)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), nth) + 1
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// nth_element
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type nth_element(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator nth
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::nth_element_impl(cont, nth, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_NTH_ELEMENT_HPP
|
|
@ -1,72 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_PARTIAL_SORT_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_PARTIAL_SORT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/partial_sort.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type partial_sort_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::partial_sort(cont, middle, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// partial_sort
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type partial_sort(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::partial_sort_impl(cont, middle, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type partial_sort_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::partial_sort(cont, middle)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// partial_sort
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type partial_sort(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::partial_sort_impl(cont, middle, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_PARTIAL_SORT_HPP
|
|
@ -1,43 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_PARTITION_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_PARTITION_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/partition.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type partition_impl(
|
||||
Container const& cont,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::partition(cont, pred)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// partition
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type partition(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::partition_impl(cont, pred, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_PARTITION_HPP
|
|
@ -1,47 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_PARTITION_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_PARTITION_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/partition_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type partition_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::partition_copy(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(first, last, pred), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// partition_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type partition_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::partition_copy_impl(first, last, result, pred, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_PARTITION_COPY_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_POP_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_POP_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/pop_heap.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type pop_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::pop_heap(cont, comp)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - 1
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// pop_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type pop_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::pop_heap_impl(cont, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type pop_heap_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::pop_heap(cont)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - 1
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// pop_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type pop_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::pop_heap_impl(cont, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_POP_HEAP_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_PUSH_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_PUSH_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/push_heap.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type push_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::push_heap(cont, comp)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// push_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type push_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::push_heap_impl(cont, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type push_heap_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::push_heap(cont)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// push_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type push_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::push_heap_impl(cont, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_PUSH_HEAP_HPP
|
|
@ -1,43 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REMOVE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REMOVE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/remove.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type remove_impl(
|
||||
Container const& cont,
|
||||
T const& value,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::remove(cont, value)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count(sprout::begin(cont), sprout::end(cont), value)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// remove
|
||||
//
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type remove(
|
||||
Container const& cont,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::remove_impl(cont, value, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REMOVE_HPP
|
|
@ -1,48 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REMOVE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REMOVE_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type remove_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
T const& value,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::remove_copy(first, last, result, value)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count(first, last, value), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// remove_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type remove_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::remove_copy_impl(first, last, result, value, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REMOVE_COPY_HPP
|
|
@ -1,48 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REMOVE_COPY_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REMOVE_COPY_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type remove_copy_if_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::remove_copy_if(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(first, last, pred), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// remove_copy_if
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type remove_copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::remove_copy_if_impl(first, last, result, pred, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REMOVE_COPY_IF_HPP
|
|
@ -1,43 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REMOVE_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REMOVE_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_if.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type remove_if_impl(
|
||||
Container const& cont,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::remove_if(cont, pred)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// remove_if
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type remove_if(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::remove_if_impl(cont, pred, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REMOVE_IF_HPP
|
|
@ -1,44 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REPLACE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REPLACE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/replace.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type replace_impl(
|
||||
Container const& cont,
|
||||
T const& old_value,
|
||||
T const& new_value,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::replace(cont, old_value, new_value)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// replace
|
||||
//
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type replace(
|
||||
Container const& cont,
|
||||
T const& old_value,
|
||||
T const& new_value
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::replace_impl(cont, old_value, new_value, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REPLACE_HPP
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REPLACE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REPLACE_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/replace_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type replace_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
T const& old_value,
|
||||
T const& new_value,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::replace_copy(first, last, result, old_value, new_value)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// replace_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type replace_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
T const& old_value,
|
||||
T const& new_value
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::replace_copy_impl(first, last, result, old_value, new_value, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REPLACE_COPY_HPP
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REPLACE_COPY_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REPLACE_COPY_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/replace_copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
T const& new_value,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::replace_copy_if(first, last, result, pred, new_value)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// replace_copy_if
|
||||
//
|
||||
template<typename Iterator, typename Result, typename T, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type replace_copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
T const& new_value
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::replace_copy_if_impl(first, last, result, pred, new_value, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REPLACE_COPY_IF_HPP
|
|
@ -1,44 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REPLACE_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REPLACE_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/replace_if.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename T, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type replace_if_impl(
|
||||
Container const& cont,
|
||||
Predicate pred,
|
||||
T const& new_value,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::replace_if(cont, pred, new_value)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// replace_if
|
||||
//
|
||||
template<typename Container, typename T, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type replace_if(
|
||||
Container const& cont,
|
||||
Predicate pred,
|
||||
T const& new_value
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::replace_if_impl(cont, pred, new_value, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REPLACE_IF_HPP
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_RESULT_OF_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_RESULT_OF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace result_of {
|
||||
//
|
||||
// algorithm
|
||||
//
|
||||
template<typename Result>
|
||||
struct algorithm {
|
||||
public:
|
||||
typedef sprout::sub_array<
|
||||
typename sprout::fixed_container_traits<
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::internal_type
|
||||
> type;
|
||||
};
|
||||
} // namespace result_of
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_RESULT_OF_HPP
|
|
@ -1,40 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REVERSE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REVERSE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/reverse.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type reverse_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::reverse(cont)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// reverse
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type reverse(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::reverse_impl(cont, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REVERSE_HPP
|
|
@ -1,46 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_REVERSE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_REVERSE_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/reverse_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type reverse_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::reverse_copy(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// reverse_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type reverse_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::reverse_copy_impl(first, last, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_REVERSE_COPY_HPP
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_ROTATE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_ROTATE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/rotate.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type rotate_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::rotate(cont, middle)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// rotate
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type rotate(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::rotate_impl(cont, middle, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_ROTATE_HPP
|
|
@ -1,48 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_ROTATE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_ROTATE_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/rotate_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type rotate_copy_impl(
|
||||
Iterator first,
|
||||
Iterator middle,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::rotate_copy(first, middle, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// rotate_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type rotate_copy(
|
||||
Iterator first,
|
||||
Iterator middle,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::rotate_copy_impl(first, middle, last, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_ROTATE_COPY_HPP
|
|
@ -1,96 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_SET_DIFFERENCE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_SET_DIFFERENCE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/set_difference.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/detail/overlap_count_2.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::set_difference(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1)
|
||||
- sprout::detail::overlap_count_2(first1, last1, first2, last2, comp)
|
||||
,
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::set_difference_impl(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_difference_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::set_difference(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1)
|
||||
- sprout::detail::overlap_count_2(first1, last1, first2, last2)
|
||||
,
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_difference(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::set_difference_impl(first1, last1, first2, last2, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_SET_DIFFERENCE_HPP
|
|
@ -1,91 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_SET_INTERSECTION_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_SET_INTERSECTION_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/set_intersection.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/detail/overlap_count_2.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::set_intersection(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
sprout::detail::overlap_count_2(first1, last1, first2, last2, comp),
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_intersection
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::set_intersection_impl(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_intersection_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::set_intersection(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
sprout::detail::overlap_count_2(first1, last1, first2, last2),
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_intersection
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_intersection(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::set_intersection_impl(first1, last1, first2, last2, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_SET_INTERSECTION_HPP
|
|
@ -1,98 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_SET_SYMMETRIC_DIFFERENCE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_SET_SYMMETRIC_DIFFERENCE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/set_symmetric_difference.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/detail/overlap_count_2.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1)
|
||||
+ NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2)
|
||||
- 2 * sprout::detail::overlap_count_2(first1, last1, first2, last2, comp)
|
||||
,
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_symmetric_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::set_symmetric_difference_impl(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1)
|
||||
+ NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2)
|
||||
- 2 * sprout::detail::overlap_count_2(first1, last1, first2, last2)
|
||||
,
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_symmetric_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_symmetric_difference(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::set_symmetric_difference_impl(first1, last1, first2, last2, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_SET_SYMMETRIC_DIFFERENCE_HPP
|
|
@ -1,98 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_SET_UNION_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_SET_UNION_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/set_union.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/detail/overlap_count_2.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::set_union(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1)
|
||||
+ NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2)
|
||||
- sprout::detail::overlap_count_2(first1, last1, first2, last2, comp)
|
||||
,
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_union
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::set_union_impl(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_union_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::set_union(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1)
|
||||
+ NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first2, last2)
|
||||
- sprout::detail::overlap_count_2(first1, last1, first2, last2)
|
||||
,
|
||||
sprout::size(result)
|
||||
)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_union
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type set_union(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::set_union_impl(first1, last1, first2, last2, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_SET_UNION_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_SORT_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_SORT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/sort.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type sort_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::sort(cont, comp)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// sort
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::sort_impl(cont, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type sort_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::sort(cont)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// sort
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type sort(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::sort_impl(cont, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_SORT_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_SORT_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_SORT_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/sort_heap.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type sort_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::sort_heap(cont, comp)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// sort_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type sort_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::sort_heap_impl(cont, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type sort_heap_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::sort_heap(cont)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// sort_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type sort_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::sort_heap_impl(cont, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_SORT_HEAP_HPP
|
|
@ -1,43 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_STABLE_PARTITION_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_STABLE_PARTITION_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_partition.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type stable_partition_impl(
|
||||
Container const& cont,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::stable_partition(cont, pred)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// stable_partition
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type stable_partition(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::stable_partition_impl(cont, pred, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_STABLE_PARTITION_HPP
|
|
@ -1,47 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_STABLE_PARTITION_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_STABLE_PARTITION_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_partition_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type stable_partition_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::stable_partition_copy(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::count_if(first, last, pred), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// stable_partition_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type stable_partition_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::stable_partition_copy_impl(first, last, result, pred, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_STABLE_PARTITION_COPY_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_STABLE_SORT_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_STABLE_SORT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_sort.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type stable_sort_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::stable_sort(cont, comp)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// stable_sort
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type stable_sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::stable_sort_impl(cont, comp, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type stable_sort_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::stable_sort(cont)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// stable_sort
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type stable_sort(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::stable_sort_impl(cont, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_STABLE_SORT_HPP
|
|
@ -1,45 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_SWAP_ELEMENT_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_SWAP_ELEMENT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type swap_element_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator pos1,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator pos2,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::swap_element(cont, pos1, pos2)),
|
||||
offset,
|
||||
offset + sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// swap_element
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type swap_element(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator pos1,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator pos2
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::swap_element_impl(cont, pos1, pos2, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_SWAP_ELEMENT_HPP
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_SWAP_ELEMENT_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_SWAP_ELEMENT_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type swap_element_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Iterator pos1,
|
||||
Iterator pos2,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::swap_element_copy(first, last, result, pos1, pos2)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// swap_element_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type swap_element_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Iterator pos1,
|
||||
Iterator pos2
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::swap_element_copy_impl(first, last, result, pos1, pos2, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_SWAP_ELEMENT_COPY_HPP
|
|
@ -1,81 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_TRANSFORM_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_TRANSFORM_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/transform.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result, typename UnaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type transform_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
UnaryOperation op,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::transform(first, last, result, op)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform
|
||||
//
|
||||
template<typename Iterator, typename Result, typename UnaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type transform(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
UnaryOperation op
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::transform_impl(first, last, result, op, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename BinaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type transform_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Result const& result,
|
||||
BinaryOperation op,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::transform(first1, last1, first2, result, op)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename BinaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type transform(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Result const& result,
|
||||
BinaryOperation op
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::transform_impl(first1, last1, first2, result, op, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_TRANSFORM_HPP
|
|
@ -1,68 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_UNIQUE_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_UNIQUE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/unique.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/detail/overlap_count.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type unique_impl(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::unique(cont)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - sprout::detail::overlap_count(sprout::begin(cont), sprout::end(cont))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// unique
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type unique(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::unique_impl(cont, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Container, typename BinaryPredicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type unique_impl(
|
||||
Container const& cont,
|
||||
BinaryPredicate pred,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::unique(cont, pred)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - sprout::detail::overlap_count(sprout::begin(cont), sprout::end(cont), pred)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// unique
|
||||
//
|
||||
template<typename Container, typename BinaryPredicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Container>::type unique(
|
||||
Container const& cont,
|
||||
BinaryPredicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::unique_impl(cont, pred, sprout::fixed_begin_offset(cont));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_UNIQUE_HPP
|
|
@ -1,78 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIT_UNIQUE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIT_UNIQUE_COPY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/unique_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array.hpp>
|
||||
#include <sprout/detail/overlap_count.hpp>
|
||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type unique_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::unique_copy(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) - sprout::detail::overlap_count(first, last), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// unique_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type unique_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::unique_copy_impl(first, last, result, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Iterator, typename Result, typename BinaryPredicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type unique_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
BinaryPredicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset
|
||||
)
|
||||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_fixed(sprout::fixed::unique_copy(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last) - sprout::detail::overlap_count(first, last, pred), sprout::size(result))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// unique_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename BinaryPredicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fit::result_of::algorithm<Result>::type unique_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
BinaryPredicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fit::detail::unique_copy_impl(first, last, result, pred, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace fit
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIT_UNIQUE_COPY_HPP
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_n.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_if.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_backward.hpp>
|
||||
#include <sprout/algorithm/fixed/transform.hpp>
|
||||
#include <sprout/algorithm/fixed/replace.hpp>
|
||||
#include <sprout/algorithm/fixed/replace_if.hpp>
|
||||
#include <sprout/algorithm/fixed/replace_copy.hpp>
|
||||
#include <sprout/algorithm/fixed/replace_copy_if.hpp>
|
||||
#include <sprout/algorithm/fixed/fill.hpp>
|
||||
#include <sprout/algorithm/fixed/fill_n.hpp>
|
||||
#include <sprout/algorithm/fixed/generate.hpp>
|
||||
#include <sprout/algorithm/fixed/generate_n.hpp>
|
||||
#include <sprout/algorithm/fixed/remove.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_if.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_copy.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_copy_if.hpp>
|
||||
#include <sprout/algorithm/fixed/unique.hpp>
|
||||
#include <sprout/algorithm/fixed/unique_copy.hpp>
|
||||
#include <sprout/algorithm/fixed/reverse.hpp>
|
||||
#include <sprout/algorithm/fixed/reverse_copy.hpp>
|
||||
#include <sprout/algorithm/fixed/rotate.hpp>
|
||||
#include <sprout/algorithm/fixed/rotate_copy.hpp>
|
||||
#include <sprout/algorithm/fixed/partition.hpp>
|
||||
#include <sprout/algorithm/fixed/partition_copy.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_partition.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_partition_copy.hpp>
|
||||
#include <sprout/algorithm/fixed/sort.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_sort.hpp>
|
||||
#include <sprout/algorithm/fixed/partial_sort.hpp>
|
||||
#include <sprout/algorithm/fixed/nth_element.hpp>
|
||||
#include <sprout/algorithm/fixed/merge.hpp>
|
||||
#include <sprout/algorithm/fixed/inplace_merge.hpp>
|
||||
#include <sprout/algorithm/fixed/set_union.hpp>
|
||||
#include <sprout/algorithm/fixed/set_intersection.hpp>
|
||||
#include <sprout/algorithm/fixed/set_difference.hpp>
|
||||
#include <sprout/algorithm/fixed/set_symmetric_difference.hpp>
|
||||
#include <sprout/algorithm/fixed/push_heap.hpp>
|
||||
#include <sprout/algorithm/fixed/pop_heap.hpp>
|
||||
#include <sprout/algorithm/fixed/make_heap.hpp>
|
||||
#include <sprout/algorithm/fixed/make_partial_heap.hpp>
|
||||
#include <sprout/algorithm/fixed/sort_heap.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element_copy.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_HPP
|
|
@ -1,61 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_COPY_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.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 copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? *(first + Indexes - offset)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::copy_impl(
|
||||
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)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_COPY_HPP
|
|
@ -1,61 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_COPY_BACKWARD_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_COPY_BACKWARD_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.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 copy_backward_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes < offset && Indexes + size >= offset && Indexes + input_size >= offset
|
||||
? *(last + Indexes - offset)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// copy_backward
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_backward(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::copy_backward_impl(
|
||||
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)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::copy_backward;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_COPY_BACKWARD_HPP
|
|
@ -1,132 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_COPY_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_COPY_IF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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_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 copy_if_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return copy_if_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator, 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 copy_if_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
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 Iterator, 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 copy_if_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) < offset
|
||||
? pred(*first)
|
||||
? copy_if_impl_2(first + 1, last, result, pred, offset, args..., *first)
|
||||
: copy_if_impl_2(first + 1, last, result, pred, offset, args...)
|
||||
: copy_if_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, 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 copy_if_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
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 Iterator, 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 copy_if_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? copy_if_impl_1(first, last, result, pred, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: copy_if_impl_2(first, last, result, pred, offset + sprout::size(result), args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_if_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return copy_if_impl_1(first, last, result, pred, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// copy_if
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::copy_if_impl(first, last, result, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::copy_if;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_COPY_IF_HPP
|
|
@ -1,37 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_COPY_N_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_COPY_N_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// copy_n
|
||||
//
|
||||
template<typename Iterator, typename Size, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_n(
|
||||
Iterator first,
|
||||
Size n,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::copy_impl(
|
||||
first,
|
||||
first + n,
|
||||
result,
|
||||
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::fixed_size>::type(),
|
||||
sprout::fixed_begin_offset(result),
|
||||
sprout::size(result),
|
||||
n
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::copy_n;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_COPY_N_HPP
|
|
@ -1,55 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_FILL_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_FILL_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename T, std::ptrdiff_t... Indexes>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type fill_impl(
|
||||
Container const& cont,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
T const& value,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::size_type size
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Container, Container>(
|
||||
cont,
|
||||
sprout::size(cont),
|
||||
(Indexes >= offset && Indexes < offset + size
|
||||
? value
|
||||
: *(sprout::fixed_begin(cont) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// fill
|
||||
//
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type fill(
|
||||
Container const& cont,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::fill_impl(
|
||||
cont,
|
||||
typename sprout::index_range<0, sprout::fixed_container_traits<Container>::fixed_size>::type(),
|
||||
value,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::fill;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_FILL_HPP
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_FILL_N_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_FILL_N_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/fill.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// fill_n
|
||||
//
|
||||
template<typename Container, typename Size, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type fill_n(
|
||||
Container const& cont,
|
||||
Size n,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::fill_impl(
|
||||
cont,
|
||||
typename sprout::index_range<0, sprout::fixed_container_traits<Container>::fixed_size>::type(),
|
||||
value,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
n
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::fill_n;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_FILL_N_HPP
|
|
@ -1,196 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_GENERATE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_GENERATE_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<std::size_t InitSize, typename Container, typename Generator, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
InitSize == sizeof...(Args) + 1,
|
||||
typename sprout::fixed_container_traits<Container>::value_type
|
||||
>::type call_gen(
|
||||
Generator gen,
|
||||
Head const& head,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return gen(head, args...);
|
||||
}
|
||||
template<std::size_t InitSize, typename Container, typename Generator, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
InitSize != sizeof...(Args) + 1,
|
||||
typename sprout::fixed_container_traits<Container>::value_type
|
||||
>::type call_gen(
|
||||
Generator gen,
|
||||
Head const& head,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return call_gen<InitSize, Container>(gen, args...);
|
||||
}
|
||||
template<typename Container, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Container>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_4(
|
||||
Container const& cont,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Container, Container>(cont, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Container, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Container>::fixed_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_4(
|
||||
Container const& cont,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return generate_impl_4(cont, args..., *(sprout::fixed_begin(cont) + sizeof...(Args)));
|
||||
}
|
||||
template<std::size_t InitSize, typename Container, typename Generator, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Container>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_3(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Container, Container>(cont, sprout::size(result), args...);
|
||||
}
|
||||
template<std::size_t InitSize, typename Container, typename Generator, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Container>::fixed_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_3(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? generate_impl_3<InitSize>(cont, gen, offset, args..., call_gen<InitSize, Container>(gen, args...))
|
||||
: generate_impl_4(cont, args...)
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Args) == 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_2_drop(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::size_type dropped_size,
|
||||
Head const& head,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Container, Container>(cont, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Container, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Args) != 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_2_drop(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::size_type dropped_size,
|
||||
Head const& head,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) + 1 != dropped_size
|
||||
? generate_impl_2_drop(cont, dropped_size, args...)
|
||||
: generate_impl_4(cont, head, args...)
|
||||
;
|
||||
}
|
||||
template<std::size_t InitSize, typename Container, typename Generator, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type generate_impl_2(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::size_type size,
|
||||
std::size_t remain,
|
||||
Head const& head,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return InitSize - remain != size
|
||||
? (remain > 1
|
||||
? generate_impl_2<InitSize>(cont, gen, offset, size, remain - 1, args..., head)
|
||||
: generate_impl_3<InitSize>(cont, gen, offset + size, args..., head)
|
||||
)
|
||||
: generate_impl_2_drop(cont, offset + size, head, args...)
|
||||
;
|
||||
}
|
||||
template<std::size_t InitSize, typename Container, typename Generator, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Container>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_1(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::size_type size,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return generate_impl_2<InitSize>(cont, gen, offset, size, InitSize, args...);
|
||||
}
|
||||
template<std::size_t InitSize, typename Container, typename Generator, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Container>::fixed_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_1(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::size_type size,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) - InitSize < offset
|
||||
? generate_impl_1<InitSize>(cont, gen, offset, size, args..., *(sprout::fixed_begin(cont) + sizeof...(Args) - InitSize))
|
||||
: generate_impl_2<InitSize>(cont, gen, offset, size, InitSize, args...)
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type generate_impl(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
typename sprout::fixed_container_traits<Container>::size_type size,
|
||||
Inits const&... inits
|
||||
)
|
||||
{
|
||||
return generate_impl_1<sizeof...(Inits)>(cont, gen, sprout::fixed_begin_offset(cont), size, inits...);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// generate
|
||||
//
|
||||
template<typename Container, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type generate(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
Inits const&... inits
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::generate_impl(cont, gen, sprout::size(cont), inits...);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::generate;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_GENERATE_HPP
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_GENERATE_N_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_GENERATE_N_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/generate.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// generate_n
|
||||
//
|
||||
template<typename Container, typename Size, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type generate_n(
|
||||
Container const& cont,
|
||||
Size n,
|
||||
Generator gen,
|
||||
Inits const&... inits
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::generate_impl(cont, gen, n, inits...);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::generate_n;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_GENERATE_N_HPP
|
|
@ -1,53 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_INPLACE_MERGE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_INPLACE_MERGE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/merge.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// inplace_merge
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type inplace_merge(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::merge(
|
||||
sprout::begin(cont),
|
||||
middle,
|
||||
middle,
|
||||
sprout::end(cont),
|
||||
cont,
|
||||
comp
|
||||
);
|
||||
}
|
||||
//
|
||||
// inplace_merge
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type inplace_merge(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
{
|
||||
return sprout::fixed::merge(
|
||||
sprout::begin(cont),
|
||||
middle,
|
||||
middle,
|
||||
sprout::end(cont),
|
||||
cont
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::inplace_merge;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_INPLACE_MERGE_HPP
|
|
@ -1,125 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_MAKE_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_MAKE_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type n = 0,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l = 1,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r = 2
|
||||
);
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_heap_impl_1(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type n,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r
|
||||
)
|
||||
{
|
||||
return comp(*(sprout::fixed_begin(cont) + offset + l), *(sprout::fixed_begin(cont) + offset + r))
|
||||
? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + r))
|
||||
? sprout::fixed::detail::make_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + r),
|
||||
comp,
|
||||
offset,
|
||||
size,
|
||||
r,
|
||||
r * 2 + 1,
|
||||
r * 2 + 2
|
||||
)
|
||||
: sprout::clone(cont)
|
||||
: comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + l))
|
||||
? sprout::fixed::detail::make_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + l),
|
||||
comp,
|
||||
offset,
|
||||
size,
|
||||
l,
|
||||
l * 2 + 1,
|
||||
l * 2 + 2
|
||||
)
|
||||
: sprout::clone(cont)
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type n,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r
|
||||
)
|
||||
{
|
||||
return r > size
|
||||
? sprout::clone(cont)
|
||||
: r == size
|
||||
? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + l))
|
||||
? sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + l)
|
||||
: sprout::clone(cont)
|
||||
: sprout::fixed::detail::make_heap_impl_1(
|
||||
sprout::fixed::detail::make_heap_impl(sprout::fixed::detail::make_heap_impl(cont, comp, offset, size, l, l * 2 + 1, l * 2 + 2), comp, offset, size, r, r * 2 + 1, r * 2 + 2),
|
||||
comp,
|
||||
offset,
|
||||
size,
|
||||
n,
|
||||
l,
|
||||
r
|
||||
)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// make_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::make_heap_impl(
|
||||
cont,
|
||||
comp,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont)
|
||||
);
|
||||
}
|
||||
//
|
||||
// make_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::make_heap_impl(
|
||||
cont,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>(),
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::make_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_MAKE_HEAP_HPP
|
|
@ -1,105 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_MAKE_PARTIAL_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_MAKE_PARTIAL_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fixed/pop_heap.hpp>
|
||||
#include <sprout/algorithm/fixed/make_heap.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_partial_heap_impl_1(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type middle_size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type n
|
||||
)
|
||||
{
|
||||
return n < size
|
||||
? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset))
|
||||
? sprout::fixed::detail::make_partial_heap_impl_1(
|
||||
sprout::fixed::detail::pop_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset),
|
||||
comp,
|
||||
offset,
|
||||
middle_size
|
||||
),
|
||||
comp,
|
||||
offset,
|
||||
size,
|
||||
middle_size,
|
||||
n + 1
|
||||
)
|
||||
: sprout::fixed::detail::make_partial_heap_impl_1(cont, comp, offset, size, middle_size, n + 1)
|
||||
: sprout::clone(cont)
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_partial_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type middle_size
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::make_partial_heap_impl_1(
|
||||
sprout::fixed::detail::make_heap_impl(cont, comp, offset, middle_size),
|
||||
comp,
|
||||
offset,
|
||||
size,
|
||||
middle_size,
|
||||
middle_size
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// make_partial_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_partial_heap(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::make_partial_heap_impl(
|
||||
cont,
|
||||
comp,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle)
|
||||
);
|
||||
}
|
||||
//
|
||||
// make_partial_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_partial_heap(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::make_partial_heap_impl(
|
||||
cont,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>(),
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::make_partial_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_MAKE_PARTIAL_HEAP_HPP
|
|
@ -1,179 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_MERGE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_MERGE_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 merge_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 merge_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return merge_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? first1 != last1
|
||||
? first2 != last2
|
||||
? comp(*first2, *first1)
|
||||
? merge_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2)
|
||||
: merge_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1)
|
||||
: merge_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1)
|
||||
: first2 != last2
|
||||
? merge_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2)
|
||||
: merge_impl_3(result, args...)
|
||||
: merge_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? merge_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: merge_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return merge_impl_1(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// merge
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type merge(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::merge_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
comp
|
||||
);
|
||||
}
|
||||
//
|
||||
// merge
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type merge(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::merge_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Result>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::merge;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_MERGE_HPP
|
|
@ -1,85 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_NTH_ELEMENT_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_NTH_ELEMENT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fixed/make_partial_heap.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type nth_element_impl_1(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type nth_size
|
||||
)
|
||||
{
|
||||
return sprout::fixed::swap_element(
|
||||
cont,
|
||||
sprout::fixed_begin(cont) + offset,
|
||||
sprout::fixed_begin(cont) + offset + nth_size
|
||||
);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type nth_element_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type nth_size
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::nth_element_impl_1(
|
||||
sprout::fixed::detail::make_partial_heap_impl(cont, comp, offset, size, nth_size + 1),
|
||||
offset,
|
||||
nth_size
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// nth_element
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type nth_element(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator nth,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::nth_element_impl(
|
||||
cont,
|
||||
comp,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), nth)
|
||||
);
|
||||
}
|
||||
//
|
||||
// nth_element
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type nth_element(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator nth
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::nth_element_impl(
|
||||
cont,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>(),
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), nth)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::nth_element;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_NTH_ELEMENT_HPP
|
|
@ -1,73 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_PARTIAL_SORT_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_PARTIAL_SORT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/make_partial_heap.hpp>
|
||||
#include <sprout/algorithm/fixed/sort_heap.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type partial_sort_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type middle_size
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::sort_heap_impl(
|
||||
sprout::fixed::detail::make_partial_heap_impl(cont, comp, offset, size, middle_size),
|
||||
comp,
|
||||
offset,
|
||||
middle_size
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// partial_sort
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type partial_sort(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::partial_sort_impl(
|
||||
cont,
|
||||
comp,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle)
|
||||
);
|
||||
}
|
||||
//
|
||||
// partial_sort
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type partial_sort(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::partial_sort_impl(
|
||||
cont,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>(),
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(cont), middle)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::partial_sort;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_PARTIAL_SORT_HPP
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_PARTITION_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_PARTITION_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/partition_copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// partition
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type partition(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fixed::partition_copy(sprout::begin(cont), sprout::end(cont), cont, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::partition;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_PARTITION_HPP
|
|
@ -1,132 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_PARTITION_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_PARTITION_COPY_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 partition_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 partition_copy_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return partition_copy_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
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 Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) < offset
|
||||
? pred(*first)
|
||||
? partition_copy_impl_2(first + 1, last, result, pred, offset, *first, args...)
|
||||
: partition_copy_impl_2(first + 1, last, result, pred, offset, args..., *first)
|
||||
: partition_copy_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
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 Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? partition_copy_impl_1(first, last, result, pred, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: partition_copy_impl_2(first, last, result, pred, offset + sprout::size(result), args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type partition_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return partition_copy_impl_1(first, last, result, pred, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// partition_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type partition_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::partition_copy_impl(first, last, result, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::partition_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_PARTITION_COPY_HPP
|
|
@ -1,89 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_POP_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_POP_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type pop_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type n = 0,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l = 1,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r = 2
|
||||
)
|
||||
{
|
||||
return r < size && comp(*(sprout::fixed_begin(cont) + offset + l), *(sprout::fixed_begin(cont) + offset + r))
|
||||
? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + r))
|
||||
? sprout::fixed::detail::pop_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + r),
|
||||
comp,
|
||||
offset,
|
||||
size,
|
||||
r,
|
||||
r * 2 + 1,
|
||||
r * 2 + 2
|
||||
)
|
||||
: sprout::clone(cont)
|
||||
: l < size
|
||||
? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + l))
|
||||
? sprout::fixed::detail::pop_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + l),
|
||||
comp,
|
||||
offset,
|
||||
size,
|
||||
l,
|
||||
l * 2 + 1,
|
||||
l * 2 + 2
|
||||
)
|
||||
: sprout::clone(cont)
|
||||
: sprout::clone(cont)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// pop_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type pop_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::pop_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::begin(cont), sprout::end(cont) - 1),
|
||||
comp,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont) - 1
|
||||
);
|
||||
}
|
||||
//
|
||||
// pop_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type pop_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::pop_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::begin(cont), sprout::end(cont) - 1),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>(),
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont) - 1
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::pop_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_POP_HEAP_HPP
|
|
@ -1,69 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_PUSH_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_PUSH_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type push_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type n
|
||||
)
|
||||
{
|
||||
return n != 0 && comp(*(sprout::fixed_begin(cont) + offset + (n - 1) / 2), *(sprout::fixed_begin(cont) + offset + n))
|
||||
? sprout::fixed::detail::push_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + (n - 1) / 2, sprout::fixed_begin(cont) + offset + n),
|
||||
comp,
|
||||
offset,
|
||||
(n - 1) / 2
|
||||
)
|
||||
: sprout::clone(cont)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// push_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type push_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::push_heap_impl(
|
||||
cont,
|
||||
comp,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont) - 1
|
||||
);
|
||||
}
|
||||
//
|
||||
// push_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type push_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::push_heap_impl(
|
||||
cont,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>(),
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont) - 1
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::push_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_PUSH_HEAP_HPP
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REMOVE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REMOVE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// remove
|
||||
//
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type remove(
|
||||
Container const& cont,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return sprout::fixed::remove_copy(sprout::begin(cont), sprout::end(cont), cont, value);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::remove;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REMOVE_HPP
|
|
@ -1,132 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REMOVE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REMOVE_COPY_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 remove_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 remove_copy_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return remove_copy_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
T const& 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 Iterator, 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,
|
||||
Result const& result,
|
||||
T const& value,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) < offset
|
||||
? *first == value
|
||||
? remove_copy_impl_2(first + 1, last, result, value, offset, args...)
|
||||
: remove_copy_impl_2(first + 1, last, result, value, offset, args..., *first)
|
||||
: remove_copy_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
T const& 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 Iterator, 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,
|
||||
Result const& result,
|
||||
T const& value,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? remove_copy_impl_1(first, last, result, value, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: remove_copy_impl_2(first, last, result, value, offset + sprout::size(result), args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return remove_copy_impl_1(first, last, result, value, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// remove_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
T const& value
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::remove_copy_impl(first, last, result, value);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::remove_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REMOVE_COPY_HPP
|
|
@ -1,132 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REMOVE_COPY_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REMOVE_COPY_IF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 remove_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 remove_copy_if_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return remove_copy_if_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
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 Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) < offset
|
||||
? pred(*first)
|
||||
? remove_copy_if_impl_2(first + 1, last, result, pred, offset, args...)
|
||||
: remove_copy_if_impl_2(first + 1, last, result, pred, offset, args..., *first)
|
||||
: remove_copy_if_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
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 Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? remove_copy_if_impl_1(first, last, result, pred, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: remove_copy_if_impl_2(first, last, result, pred, offset + sprout::size(result), args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy_if_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return remove_copy_if_impl_1(first, last, result, pred, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// remove_copy_if
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::remove_copy_if_impl(first, last, result, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::remove_copy_if;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REMOVE_COPY_IF_HPP
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REMOVE_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REMOVE_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_copy_if.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// remove_if
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type remove_if(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fixed::remove_copy_if(sprout::begin(cont), sprout::end(cont), cont, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::remove_if;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REMOVE_IF_HPP
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REPLACE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REPLACE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/replace_copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// replace
|
||||
//
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type replace(
|
||||
Container const& cont,
|
||||
T const& old_value,
|
||||
T const& new_value
|
||||
)
|
||||
{
|
||||
return sprout::fixed::replace_copy(sprout::begin(cont), sprout::end(cont), cont, old_value, new_value);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::replace;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REPLACE_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REPLACE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REPLACE_COPY_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.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,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
T const& old_value,
|
||||
T const& new_value,
|
||||
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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? *(first + Indexes - offset) == old_value ? new_value : *(first + Indexes - offset)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// replace_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
T const& old_value,
|
||||
T const& new_value
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::replace_copy_impl(
|
||||
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)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::replace_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REPLACE_COPY_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REPLACE_COPY_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REPLACE_COPY_IF_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.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,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
Predicate pred,
|
||||
T const& new_value,
|
||||
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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? pred(*(first + Indexes - offset)) ? new_value : *(first + Indexes - offset)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// replace_copy_if
|
||||
//
|
||||
template<typename Iterator, typename Result, typename T, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
T const& new_value
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::replace_copy_if_impl(
|
||||
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)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::replace_copy_if;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REPLACE_COPY_IF_HPP
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REPLACE_IF_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REPLACE_IF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/replace_copy_if.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// replace_if
|
||||
//
|
||||
template<typename Container, typename T, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type replace_if(
|
||||
Container const& cont,
|
||||
Predicate pred,
|
||||
T const& new_value
|
||||
)
|
||||
{
|
||||
return sprout::fixed::replace_copy_if(sprout::begin(cont), sprout::end(cont), cont, pred, new_value);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::replace_if;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REPLACE_IF_HPP
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_RESULT_OF_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_RESULT_OF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace result_of {
|
||||
//
|
||||
// algorithm
|
||||
//
|
||||
template<typename Result>
|
||||
struct algorithm {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Result>::clone_type type;
|
||||
};
|
||||
} // namespace result_of
|
||||
} // namespace fixed
|
||||
|
||||
namespace result_of {
|
||||
using sprout::fixed::result_of::algorithm;
|
||||
} // namespace result_of
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_RESULT_OF_HPP
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REVERSE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REVERSE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/reverse_copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// reverse
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type reverse(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fixed::reverse_copy(sprout::begin(cont), sprout::end(cont), cont);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::reverse;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REVERSE_HPP
|
|
@ -1,62 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_REVERSE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_REVERSE_COPY_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.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,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? *(last - 1 - Indexes + offset)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// reverse_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type reverse_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::reverse_copy_impl(
|
||||
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)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::reverse_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REVERSE_COPY_HPP
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_ROTATE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_ROTATE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/rotate_copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// rotate
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type rotate(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
{
|
||||
return sprout::fixed::rotate_copy(sprout::begin(cont), middle, sprout::end(cont), cont);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::rotate;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_ROTATE_HPP
|
|
@ -1,67 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_ROTATE_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_ROTATE_COPY_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.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 rotate_copy_impl(
|
||||
Iterator first,
|
||||
Iterator middle,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? (Indexes < offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(middle, last)
|
||||
? *(middle + Indexes - offset)
|
||||
: *((first + Indexes - offset) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, middle))
|
||||
)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// rotate_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type rotate_copy(
|
||||
Iterator first,
|
||||
Iterator middle,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::rotate_copy_impl(
|
||||
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)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::rotate_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_ROTATE_COPY_HPP
|
|
@ -1,181 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_SET_DIFFERENCE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_SET_DIFFERENCE_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 set_difference_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 set_difference_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return set_difference_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? first1 != last1
|
||||
? first2 != last2
|
||||
? comp(*first1, *first2)
|
||||
? set_difference_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1)
|
||||
: comp(*first2, *first1)
|
||||
? set_difference_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...)
|
||||
: set_difference_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args...)
|
||||
: set_difference_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1)
|
||||
: first2 != last2
|
||||
? set_difference_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...)
|
||||
: set_difference_impl_3(result, args...)
|
||||
: set_difference_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? set_difference_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: set_difference_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return set_difference_impl_1(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::set_difference_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
comp
|
||||
);
|
||||
}
|
||||
//
|
||||
// set_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_difference(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::set_difference_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Result>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::set_difference;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SET_DIFFERENCE_HPP
|
|
@ -1,181 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_SET_INTERSECTION_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_SET_INTERSECTION_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 set_intersection_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 set_intersection_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return set_intersection_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? first1 != last1
|
||||
? first2 != last2
|
||||
? comp(*first1, *first2)
|
||||
? set_intersection_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args...)
|
||||
: comp(*first2, *first1)
|
||||
? set_intersection_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...)
|
||||
: set_intersection_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args..., *first1)
|
||||
: set_intersection_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args...)
|
||||
: first2 != last2
|
||||
? set_intersection_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...)
|
||||
: set_intersection_impl_3(result, args...)
|
||||
: set_intersection_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? set_intersection_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: set_intersection_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return set_intersection_impl_1(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_intersection
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::set_intersection_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
comp
|
||||
);
|
||||
}
|
||||
//
|
||||
// set_intersection
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_intersection(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::set_intersection_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Result>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::set_intersection;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SET_INTERSECTION_HPP
|
|
@ -1,181 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_SET_SYMMETRIC_DIFFERENCE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_SET_SYMMETRIC_DIFFERENCE_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 set_symmetric_difference_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 set_symmetric_difference_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return set_symmetric_difference_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? first1 != last1
|
||||
? first2 != last2
|
||||
? comp(*first1, *first2)
|
||||
? set_symmetric_difference_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1)
|
||||
: comp(*first2, *first1)
|
||||
? set_symmetric_difference_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2)
|
||||
: set_symmetric_difference_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args...)
|
||||
: set_symmetric_difference_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1)
|
||||
: first2 != last2
|
||||
? set_symmetric_difference_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2)
|
||||
: set_symmetric_difference_impl_3(result, args...)
|
||||
: set_symmetric_difference_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? set_symmetric_difference_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: 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>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_symmetric_difference_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return set_symmetric_difference_impl_1(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_symmetric_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::set_symmetric_difference_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
comp
|
||||
);
|
||||
}
|
||||
//
|
||||
// set_symmetric_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_symmetric_difference(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::set_symmetric_difference_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Result>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::set_symmetric_difference;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SET_SYMMETRIC_DIFFERENCE_HPP
|
|
@ -1,181 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_SET_UNION_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_SET_UNION_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 set_union_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 set_union_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return set_union_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? first1 != last1
|
||||
? first2 != last2
|
||||
? comp(*first1, *first2)
|
||||
? set_union_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1)
|
||||
: comp(*first2, *first1)
|
||||
? set_union_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2)
|
||||
: set_union_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args..., *first1)
|
||||
: set_union_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1)
|
||||
: first2 != last2
|
||||
? set_union_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2)
|
||||
: set_union_impl_3(result, args...)
|
||||
: set_union_impl_3(result, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
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 Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? set_union_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: set_union_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return set_union_impl_1(first1, last1, first2, last2, result, comp, sprout::fixed_begin_offset(result));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// set_union
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, 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,
|
||||
Result const& result,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::set_union_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
comp
|
||||
);
|
||||
}
|
||||
//
|
||||
// set_union
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_union(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Iterator2 last2,
|
||||
Result const& result
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::set_union_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
last2,
|
||||
result,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Result>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::set_union;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SET_UNION_HPP
|
|
@ -1,194 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_SORT_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_SORT_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Iterator>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::value_type const& sort_select_pivot(
|
||||
Iterator origin,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type start,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type end
|
||||
)
|
||||
{ // pivot を選ぶ(中央の要素)
|
||||
return *(origin + (end + start) / 2);
|
||||
}
|
||||
template<typename Container, typename Iterator, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::difference_type sort_find_l(
|
||||
Iterator origin,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l,
|
||||
typename sprout::fixed_container_traits<Container>::value_type const& p
|
||||
)
|
||||
{ // left を見つける
|
||||
return comp(*(origin + l), p) ? sort_find_l<Container>(origin, comp, l + 1, p) : l;
|
||||
}
|
||||
template<typename Container, typename Iterator, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::difference_type sort_find_r(
|
||||
Iterator origin,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r,
|
||||
typename sprout::fixed_container_traits<Container>::value_type const& p
|
||||
)
|
||||
{ // right を見つける
|
||||
return comp(p, *(origin + r)) ? sort_find_r<Container>(origin, comp, r - 1, p) : r;
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type swap_lr(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r
|
||||
);
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_part_l(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type start,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l
|
||||
)
|
||||
{ // 左側をソート
|
||||
return start < l - 1 ? sort_start(cont, start, l - 1, comp) : sprout::clone(cont);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_part_r(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type end,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r
|
||||
)
|
||||
{ // 右側をソート
|
||||
return r + 1 < end ? sort_start(cont, r + 1, end, comp) : sprout::clone(cont);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_part_lr(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type start,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type end,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r
|
||||
)
|
||||
{ // 左右に分けてソート
|
||||
return sort_part_r(sort_part_l(cont, start, comp, l), end, comp, r);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_next(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type start,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type end,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r,
|
||||
typename sprout::fixed_container_traits<Container>::value_type const& p
|
||||
)
|
||||
{ // left と right 比較して、左右に分けてソートするか、またはスワップしてこの範囲のソートを続ける
|
||||
return l >= r
|
||||
? sort_part_lr(cont, start, end, comp, l, r)
|
||||
: sort_lr(sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + l, sprout::fixed_begin(cont) + r), start, end, comp, l + 1, r - 1, p)
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_lr(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type start,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type end,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type l,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type r,
|
||||
typename sprout::fixed_container_traits<Container>::value_type const& p
|
||||
)
|
||||
{ // left と right を検索
|
||||
return sort_next(
|
||||
cont,
|
||||
start,
|
||||
end,
|
||||
comp,
|
||||
sort_find_l<Container>(sprout::fixed_begin(cont), comp, l, p),
|
||||
sort_find_r<Container>(sprout::fixed_begin(cont), comp, r, p),
|
||||
p
|
||||
);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_start(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type start,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type end,
|
||||
Compare comp
|
||||
)
|
||||
{ // pivot を選択してソートを開始
|
||||
return sort_lr(cont, start, end, comp, start, end, sort_select_pivot<Container>(sprout::fixed_begin(cont), start, end));
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// sort
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size <= 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::clone(cont);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size > 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::sort_start(
|
||||
cont,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::end(cont) - 1),
|
||||
comp
|
||||
);
|
||||
}
|
||||
//
|
||||
// sort
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size <= 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type sort(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::clone(cont);
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size > 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type sort(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::sort_start(
|
||||
cont,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::end(cont) - 1),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>()
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::sort;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SORT_HPP
|
|
@ -1,75 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_SORT_HEAP_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_SORT_HEAP_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#include <sprout/algorithm/fixed/pop_heap.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_heap_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type offset,
|
||||
typename sprout::fixed_container_traits<Container>::difference_type size
|
||||
)
|
||||
{
|
||||
return size < 2
|
||||
? sprout::clone(cont)
|
||||
: sprout::fixed::detail::sort_heap_impl(
|
||||
sprout::fixed::detail::pop_heap_impl(
|
||||
sprout::fixed::swap_element(cont, sprout::begin(cont), sprout::begin(cont) + size - 1),
|
||||
comp,
|
||||
offset,
|
||||
size - 1
|
||||
),
|
||||
comp,
|
||||
offset,
|
||||
size - 1
|
||||
)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// sort_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::sort_heap_impl(
|
||||
cont,
|
||||
comp,
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont)
|
||||
);
|
||||
}
|
||||
//
|
||||
// sort_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::sort_heap_impl(
|
||||
cont,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>(),
|
||||
sprout::fixed_begin_offset(cont),
|
||||
sprout::size(cont)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::sort_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SORT_HEAP_HPP
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_STABLE_PARTITION_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_STABLE_PARTITION_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_partition_copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// stable_partition
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type stable_partition(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fixed::stable_partition_copy(sprout::begin(cont), sprout::end(cont), cont, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::stable_partition;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_STABLE_PARTITION_HPP
|
|
@ -1,173 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_STABLE_PARTITION_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_STABLE_PARTITION_COPY_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
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 stable_partition_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 stable_partition_copy_impl_4(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return stable_partition_copy_impl_4(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args)));
|
||||
}
|
||||
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
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 Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) < offset
|
||||
? !pred(*first)
|
||||
? stable_partition_copy_impl_3(first + 1, last, result, pred, offset, args..., *first)
|
||||
: stable_partition_copy_impl_3(first + 1, last, result, pred, offset, args...)
|
||||
: stable_partition_copy_impl_4(result, args...)
|
||||
;
|
||||
}
|
||||
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Iterator origin,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Iterator origin,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) < offset
|
||||
? pred(*first)
|
||||
? stable_partition_copy_impl_2(first + 1, last, result, pred, offset, origin, args..., *first)
|
||||
: stable_partition_copy_impl_2(first + 1, last, result, pred, offset, origin, args...)
|
||||
: stable_partition_copy_impl_3(origin, last, result, pred, offset, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Iterator origin,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Iterator, 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,
|
||||
Result const& result,
|
||||
Predicate pred,
|
||||
typename sprout::fixed_container_traits<Result>::difference_type offset,
|
||||
Iterator origin,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sizeof...(Args) < offset
|
||||
? stable_partition_copy_impl_1(first, last, result, pred, offset, origin, args..., *(sprout::fixed_begin(result) + sizeof...(Args)))
|
||||
: stable_partition_copy_impl_2(first, last, result, pred, offset + sprout::size(result), origin, args...)
|
||||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type stable_partition_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return stable_partition_copy_impl_1(first, last, result, pred, sprout::fixed_begin_offset(result), first);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// stable_partition_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type stable_partition_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Predicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::stable_partition_copy_impl(first, last, result, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::stable_partition_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_STABLE_PARTITION_COPY_HPP
|
|
@ -1,262 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_STABLE_SORT_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_STABLE_SORT_HPP
|
||||
|
||||
#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/algorithm/fixed/result_of.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare, std::ptrdiff_t I1, std::ptrdiff_t... Indexes, std::ptrdiff_t I2, std::ptrdiff_t... SortedIndexes, std::ptrdiff_t... NextIndexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Indexes) != 0 && sizeof...(SortedIndexes) != 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<I1, Indexes...>,
|
||||
sprout::index_tuple<I2, SortedIndexes...>,
|
||||
sprout::index_tuple<NextIndexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
);
|
||||
template<typename Container, std::ptrdiff_t... Indexes>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type stable_sort_impl_finish(
|
||||
Container const& cont,
|
||||
sprout::index_tuple<Indexes...>
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Container, Container>(result, sprout::size(result), (*(sprout::fixed_begin(cont) + Indexes))...);
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t I1, std::ptrdiff_t... Indexes, std::ptrdiff_t I2, std::ptrdiff_t... SortedIndexes, std::ptrdiff_t... NextIndexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Indexes) == 0 && sizeof...(SortedIndexes) == 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<I1, Indexes...>,
|
||||
sprout::index_tuple<I2, SortedIndexes...>,
|
||||
sprout::index_tuple<NextIndexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return comp(*(sprout::fixed_begin(cont) + I1), *(sprout::fixed_begin(cont) + I2))
|
||||
? stable_sort_impl_finish(cont, sprout::index_tuple<PreIndexes..., NextIndexes..., I1, I2, SortedIndexes..., PostIndexes...>())
|
||||
: stable_sort_impl_finish(cont, sprout::index_tuple<PreIndexes..., NextIndexes..., I2, I1, SortedIndexes..., PostIndexes...>())
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t I1, std::ptrdiff_t... Indexes, std::ptrdiff_t I2, std::ptrdiff_t... SortedIndexes, std::ptrdiff_t... NextIndexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Indexes) == 0 && sizeof...(SortedIndexes) != 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<I1, Indexes...>,
|
||||
sprout::index_tuple<I2, SortedIndexes...>,
|
||||
sprout::index_tuple<NextIndexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return comp(*(sprout::fixed_begin(cont) + I1), *(sprout::fixed_begin(cont) + I2))
|
||||
? stable_sort_impl_finish(cont, sprout::index_tuple<PreIndexes..., NextIndexes..., I1, I2, SortedIndexes..., PostIndexes...>())
|
||||
: stable_sort_impl_4(cont, comp, sprout::index_tuple<I1>(), sprout::index_tuple<SortedIndexes...>(), sprout::index_tuple<NextIndexes..., I2>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>())
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t I1, std::ptrdiff_t... Indexes, std::ptrdiff_t I2, std::ptrdiff_t... SortedIndexes, std::ptrdiff_t... NextIndexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Indexes) != 0 && sizeof...(SortedIndexes) == 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<I1, Indexes...>,
|
||||
sprout::index_tuple<I2, SortedIndexes...>,
|
||||
sprout::index_tuple<NextIndexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return comp(*(sprout::fixed_begin(cont) + I1), *(sprout::fixed_begin(cont) + I2))
|
||||
? stable_sort_impl_4(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<NextIndexes..., I1, I2, SortedIndexes...>(), sprout::index_tuple<>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>())
|
||||
: stable_sort_impl_4(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<NextIndexes..., I2, I1, SortedIndexes...>(), sprout::index_tuple<>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>())
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t I1, std::ptrdiff_t... Indexes, std::ptrdiff_t I2, std::ptrdiff_t... SortedIndexes, std::ptrdiff_t... NextIndexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Indexes) != 0 && sizeof...(SortedIndexes) != 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<I1, Indexes...>,
|
||||
sprout::index_tuple<I2, SortedIndexes...>,
|
||||
sprout::index_tuple<NextIndexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return comp(*(sprout::fixed_begin(cont) + I1), *(sprout::fixed_begin(cont) + I2))
|
||||
? stable_sort_impl_4(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<NextIndexes..., I1, I2, SortedIndexes...>(), sprout::index_tuple<>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>())
|
||||
: stable_sort_impl_4(cont, comp, sprout::index_tuple<I1, Indexes...>(), sprout::index_tuple<SortedIndexes...>(), sprout::index_tuple<NextIndexes..., I2>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>())
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t I, std::ptrdiff_t... Indexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type stable_sort_impl_3(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<I, Indexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return stable_sort_impl_4(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<I>(), sprout::index_tuple<>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>());
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t... Indexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sizeof...(Indexes) <= 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_2(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return stable_sort_impl_finish(cont, sprout::index_tuple<PreIndexes..., Indexes..., PostIndexes...>());
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t... Indexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sizeof...(Indexes) > 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_2(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return stable_sort_impl_3(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>());
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t I, std::ptrdiff_t... Indexes, std::ptrdiff_t... RangeIndexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Indexes) == 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_1(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<I, Indexes...>,
|
||||
sprout::index_tuple<RangeIndexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return I < sprout::fixed_begin_offset(cont)
|
||||
? stable_sort_impl_2(cont, comp, sprout::index_tuple<RangeIndexes...>(), sprout::index_tuple<PreIndexes..., I>(), sprout::index_tuple<PostIndexes...>())
|
||||
: I >= sprout::fixed_end_offset(cont)
|
||||
? stable_sort_impl_2(cont, comp, sprout::index_tuple<RangeIndexes...>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes..., I>())
|
||||
: stable_sort_impl_2(cont, comp, sprout::index_tuple<RangeIndexes..., I>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>())
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t I, std::ptrdiff_t... Indexes, std::ptrdiff_t... RangeIndexes, std::ptrdiff_t... PreIndexes, std::ptrdiff_t... PostIndexes>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Indexes) != 0,
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_1(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<I, Indexes...>,
|
||||
sprout::index_tuple<RangeIndexes...>,
|
||||
sprout::index_tuple<PreIndexes...>,
|
||||
sprout::index_tuple<PostIndexes...>
|
||||
)
|
||||
{
|
||||
return I < sprout::fixed_begin_offset(cont)
|
||||
? stable_sort_impl_1(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<RangeIndexes...>(), sprout::index_tuple<PreIndexes..., I>(), sprout::index_tuple<PostIndexes...>())
|
||||
: I >= sprout::fixed_end_offset(cont)
|
||||
? stable_sort_impl_1(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<RangeIndexes...>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes..., I>())
|
||||
: stable_sort_impl_1(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<RangeIndexes..., I>(), sprout::index_tuple<PreIndexes...>(), sprout::index_tuple<PostIndexes...>())
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t... Indexes>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type stable_sort_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<Indexes...>
|
||||
)
|
||||
{
|
||||
return stable_sort_impl_1(cont, comp, sprout::index_tuple<Indexes...>(), sprout::index_tuple<>(), sprout::index_tuple<>(), sprout::index_tuple<>());
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// stable_sort
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size <= 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::clone(cont);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size > 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::stable_sort_impl(
|
||||
cont,
|
||||
comp,
|
||||
typename sprout::index_range<0, sprout::fixed_container_traits<Container>::fixed_size>::type()
|
||||
);
|
||||
}
|
||||
//
|
||||
// stable_sort
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size <= 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::clone(cont);
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size > 1),
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::stable_sort_impl(
|
||||
cont,
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::less<typename sprout::fixed_container_traits<Container>::value_type>(),
|
||||
typename sprout::index_range<0, sprout::fixed_container_traits<Container>::fixed_size>::type()
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::stable_sort;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_STABLE_SORT_HPP
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element_copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// swap_element
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type swap_element(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator pos1,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator pos2
|
||||
)
|
||||
{
|
||||
return sprout::fixed::swap_element_copy(sprout::begin(cont), sprout::end(cont), cont, pos1, pos2);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::swap_element;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_HPP
|
|
@ -1,71 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_COPY_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_COPY_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.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,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
Iterator pos1,
|
||||
Iterator 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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? first + Indexes - offset == pos1
|
||||
? *pos2
|
||||
: first + Indexes - offset == pos2
|
||||
? *pos1
|
||||
: *(first + Indexes - offset)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// swap_element_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type swap_element_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
Iterator pos1,
|
||||
Iterator pos2
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::swap_element_copy_impl(
|
||||
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)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::swap_element_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_COPY_HPP
|
|
@ -1,113 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_TRANSFORM_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_TRANSFORM_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.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, typename UnaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type transform_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
UnaryOperation op,
|
||||
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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? op(*(first + Indexes - offset))
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform
|
||||
//
|
||||
template<typename Iterator, typename Result, typename UnaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type transform(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
UnaryOperation op
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::transform_impl(
|
||||
first,
|
||||
last,
|
||||
result,
|
||||
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::fixed_size>::type(),
|
||||
op,
|
||||
sprout::fixed_begin_offset(result),
|
||||
sprout::size(result),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, last)
|
||||
);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, typename Result, std::ptrdiff_t... Indexes, typename BinaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type transform_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Result const& result,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
BinaryOperation op,
|
||||
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
|
||||
)
|
||||
{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? op(*(first1 + Indexes - offset), *(first2 + Indexes - offset))
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// transform
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename BinaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type transform(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
Result const& result,
|
||||
BinaryOperation op
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::transform_impl(
|
||||
first1,
|
||||
last1,
|
||||
first2,
|
||||
result,
|
||||
typename sprout::index_range<0, sprout::fixed_container_traits<Result>::fixed_size>::type(),
|
||||
op,
|
||||
sprout::fixed_begin_offset(result),
|
||||
sprout::size(result),
|
||||
NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first1, last1)
|
||||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::transform;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_TRANSFORM_HPP
|
|
@ -1,38 +0,0 @@
|
|||
#ifndef SPROUT_ALGORITHM_FIXED_UNIQUE_HPP
|
||||
#define SPROUT_ALGORITHM_FIXED_UNIQUE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/unique_copy.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
//
|
||||
// unique
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type unique(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::fixed::unique_copy(sprout::begin(cont), sprout::end(cont), cont);
|
||||
}
|
||||
|
||||
//
|
||||
// unique
|
||||
//
|
||||
template<typename Container, typename BinaryPredicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type unique(
|
||||
Container const& cont,
|
||||
BinaryPredicate pred
|
||||
)
|
||||
{
|
||||
return sprout::fixed::unique_copy(sprout::begin(cont), sprout::end(cont), cont, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::unique;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_UNIQUE_HPP
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue