mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-05-10 09:23:30 +00:00
algorithm, operation 全面修正
This commit is contained in:
parent
21f5d5191a
commit
5e67195030
244 changed files with 4764 additions and 831 deletions
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed.hpp>
|
||||
#include <sprout/algorithm/outfit.hpp>
|
||||
#include <sprout/algorithm/infit.hpp>
|
||||
#include <sprout/algorithm/fit.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_HPP
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy.hpp>
|
||||
#include <sprout/algorithm/outfit/copy.hpp>
|
||||
#include <sprout/algorithm/infit/copy.hpp>
|
||||
#include <sprout/algorithm/fit/copy.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COPY_HPP
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_backward.hpp>
|
||||
#include <sprout/algorithm/outfit/copy_backward.hpp>
|
||||
#include <sprout/algorithm/infit/copy_backward.hpp>
|
||||
#include <sprout/algorithm/fit/copy_backward.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COPY_BACKWARD_HPP
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_if.hpp>
|
||||
#include <sprout/algorithm/outfit/copy_if.hpp>
|
||||
#include <sprout/algorithm/infit/copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/copy_if.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COPY_IF_HPP
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_n.hpp>
|
||||
#include <sprout/algorithm/outfit/copy_n.hpp>
|
||||
#include <sprout/algorithm/infit/copy_n.hpp>
|
||||
#include <sprout/algorithm/fit/copy_n.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_COPY_N_HPP
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/fill.hpp>
|
||||
#include <sprout/algorithm/outfit/fill.hpp>
|
||||
#include <sprout/algorithm/infit/fill.hpp>
|
||||
#include <sprout/algorithm/fit/fill.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FILL_HPP
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/fill_n.hpp>
|
||||
#include <sprout/algorithm/outfit/fill_n.hpp>
|
||||
#include <sprout/algorithm/infit/fill_n.hpp>
|
||||
#include <sprout/algorithm/fit/fill_n.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FILL_N_HPP
|
||||
|
|
50
sprout/algorithm/fit.hpp
Normal file
50
sprout/algorithm/fit.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#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
|
46
sprout/algorithm/fit/copy.hpp
Normal file
46
sprout/algorithm/fit/copy.hpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#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
|
46
sprout/algorithm/fit/copy_backward.hpp
Normal file
46
sprout/algorithm/fit/copy_backward.hpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#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
|
47
sprout/algorithm/fit/copy_if.hpp
Normal file
47
sprout/algorithm/fit/copy_if.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#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
|
45
sprout/algorithm/fit/copy_n.hpp
Normal file
45
sprout/algorithm/fit/copy_n.hpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#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
|
42
sprout/algorithm/fit/fill.hpp
Normal file
42
sprout/algorithm/fit/fill.hpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#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
|
45
sprout/algorithm/fit/fill_n.hpp
Normal file
45
sprout/algorithm/fit/fill_n.hpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#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
|
44
sprout/algorithm/fit/generate.hpp
Normal file
44
sprout/algorithm/fit/generate.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#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
|
47
sprout/algorithm/fit/generate_n.hpp
Normal file
47
sprout/algorithm/fit/generate_n.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#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
|
71
sprout/algorithm/fit/inplace_merge.hpp
Normal file
71
sprout/algorithm/fit/inplace_merge.hpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
#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
|
67
sprout/algorithm/fit/make_heap.hpp
Normal file
67
sprout/algorithm/fit/make_heap.hpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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
|
72
sprout/algorithm/fit/make_partial_heap.hpp
Normal file
72
sprout/algorithm/fit/make_partial_heap.hpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
#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
|
91
sprout/algorithm/fit/merge.hpp
Normal file
91
sprout/algorithm/fit/merge.hpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
#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
|
72
sprout/algorithm/fit/nth_element.hpp
Normal file
72
sprout/algorithm/fit/nth_element.hpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
#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
|
72
sprout/algorithm/fit/partial_sort.hpp
Normal file
72
sprout/algorithm/fit/partial_sort.hpp
Normal file
|
@ -0,0 +1,72 @@
|
|||
#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
|
43
sprout/algorithm/fit/partition.hpp
Normal file
43
sprout/algorithm/fit/partition.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#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
|
47
sprout/algorithm/fit/partition_copy.hpp
Normal file
47
sprout/algorithm/fit/partition_copy.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#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
|
67
sprout/algorithm/fit/pop_heap.hpp
Normal file
67
sprout/algorithm/fit/pop_heap.hpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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
|
67
sprout/algorithm/fit/push_heap.hpp
Normal file
67
sprout/algorithm/fit/push_heap.hpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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
|
43
sprout/algorithm/fit/remove.hpp
Normal file
43
sprout/algorithm/fit/remove.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#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
|
48
sprout/algorithm/fit/remove_copy.hpp
Normal file
48
sprout/algorithm/fit/remove_copy.hpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#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
|
48
sprout/algorithm/fit/remove_copy_if.hpp
Normal file
48
sprout/algorithm/fit/remove_copy_if.hpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#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
|
43
sprout/algorithm/fit/remove_if.hpp
Normal file
43
sprout/algorithm/fit/remove_if.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#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
|
44
sprout/algorithm/fit/replace.hpp
Normal file
44
sprout/algorithm/fit/replace.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#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
|
50
sprout/algorithm/fit/replace_copy.hpp
Normal file
50
sprout/algorithm/fit/replace_copy.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#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
|
50
sprout/algorithm/fit/replace_copy_if.hpp
Normal file
50
sprout/algorithm/fit/replace_copy_if.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#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
|
44
sprout/algorithm/fit/replace_if.hpp
Normal file
44
sprout/algorithm/fit/replace_if.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#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
|
27
sprout/algorithm/fit/result_of.hpp
Normal file
27
sprout/algorithm/fit/result_of.hpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#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
|
40
sprout/algorithm/fit/reverse.hpp
Normal file
40
sprout/algorithm/fit/reverse.hpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#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
|
46
sprout/algorithm/fit/reverse_copy.hpp
Normal file
46
sprout/algorithm/fit/reverse_copy.hpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#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
|
42
sprout/algorithm/fit/rotate.hpp
Normal file
42
sprout/algorithm/fit/rotate.hpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#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
|
48
sprout/algorithm/fit/rotate_copy.hpp
Normal file
48
sprout/algorithm/fit/rotate_copy.hpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#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
|
96
sprout/algorithm/fit/set_difference.hpp
Normal file
96
sprout/algorithm/fit/set_difference.hpp
Normal file
|
@ -0,0 +1,96 @@
|
|||
#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
|
91
sprout/algorithm/fit/set_intersection.hpp
Normal file
91
sprout/algorithm/fit/set_intersection.hpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
#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
|
98
sprout/algorithm/fit/set_symmetric_difference.hpp
Normal file
98
sprout/algorithm/fit/set_symmetric_difference.hpp
Normal file
|
@ -0,0 +1,98 @@
|
|||
#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
|
98
sprout/algorithm/fit/set_union.hpp
Normal file
98
sprout/algorithm/fit/set_union.hpp
Normal file
|
@ -0,0 +1,98 @@
|
|||
#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
|
67
sprout/algorithm/fit/sort.hpp
Normal file
67
sprout/algorithm/fit/sort.hpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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
|
67
sprout/algorithm/fit/sort_heap.hpp
Normal file
67
sprout/algorithm/fit/sort_heap.hpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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
|
43
sprout/algorithm/fit/stable_partition.hpp
Normal file
43
sprout/algorithm/fit/stable_partition.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#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
|
47
sprout/algorithm/fit/stable_partition_copy.hpp
Normal file
47
sprout/algorithm/fit/stable_partition_copy.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#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
|
67
sprout/algorithm/fit/stable_sort.hpp
Normal file
67
sprout/algorithm/fit/stable_sort.hpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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
|
45
sprout/algorithm/fit/swap_element.hpp
Normal file
45
sprout/algorithm/fit/swap_element.hpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#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
|
50
sprout/algorithm/fit/swap_element_copy.hpp
Normal file
50
sprout/algorithm/fit/swap_element_copy.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#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
|
81
sprout/algorithm/fit/transform.hpp
Normal file
81
sprout/algorithm/fit/transform.hpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
#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
|
68
sprout/algorithm/fit/unique.hpp
Normal file
68
sprout/algorithm/fit/unique.hpp
Normal file
|
@ -0,0 +1,68 @@
|
|||
#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
|
78
sprout/algorithm/fit/unique_copy.hpp
Normal file
78
sprout/algorithm/fit/unique_copy.hpp
Normal file
|
@ -0,0 +1,78 @@
|
|||
#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
|
|
@ -6,13 +6,14 @@
|
|||
#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_container_traits<Result>::fixed_container_type copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -22,19 +23,21 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
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_container_traits<Result>::fixed_container_type copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
|
@ -51,6 +54,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_COPY_HPP
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#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_container_traits<Result>::fixed_container_type copy_backward_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_backward_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -22,19 +23,21 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
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_container_traits<Result>::fixed_container_type copy_backward(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_backward(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
|
@ -51,6 +54,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::copy_backward;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_COPY_BACKWARD_HPP
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -12,18 +13,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type copy_if_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type copy_if_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -34,7 +35,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type copy_if_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -44,12 +45,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type copy_if_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -69,7 +70,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type copy_if_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -79,12 +80,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type copy_if_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -100,7 +101,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type copy_if_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_if_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -114,7 +115,7 @@ namespace sprout {
|
|||
// copy_if
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type copy_if(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -124,6 +125,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// copy_n
|
||||
//
|
||||
template<typename Iterator, typename Size, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type copy_n(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type copy_n(
|
||||
Iterator first,
|
||||
Size n,
|
||||
Result const& result
|
||||
|
@ -29,6 +30,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::copy_n;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_COPY_N_HPP
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
#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_container_traits<Container>::fixed_container_type fill_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type fill_impl(
|
||||
Container const& cont,
|
||||
sprout::index_tuple<Indexes...>,
|
||||
T const& value,
|
||||
|
@ -19,19 +20,21 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Container>::size_type size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Container>::fixed_container_type{
|
||||
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_container_traits<Container>::fixed_container_type fill(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type fill(
|
||||
Container const& cont,
|
||||
T const& value
|
||||
)
|
||||
|
@ -45,6 +48,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::fill;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_FILL_HPP
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -13,7 +14,7 @@ namespace sprout {
|
|||
// fill_n
|
||||
//
|
||||
template<typename Container, typename Size, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type fill_n(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type fill_n(
|
||||
Container const& cont,
|
||||
Size n,
|
||||
T const& value
|
||||
|
@ -28,6 +29,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::fill_n;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_FILL_N_HPP
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#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 {
|
||||
|
@ -37,18 +38,18 @@ namespace sprout {
|
|||
template<typename Container, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Container>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_4(
|
||||
Container const& cont,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Container>::fixed_container_type{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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_4(
|
||||
Container const& cont,
|
||||
Args const&... args
|
||||
|
@ -59,7 +60,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_3(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
|
@ -67,12 +68,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Container>::fixed_container_type{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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_3(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
|
@ -88,7 +89,7 @@ namespace sprout {
|
|||
template<typename Container, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sizeof...(Args) == 0,
|
||||
typename sprout::fixed_container_traits<Container>::fixed_container_type
|
||||
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,
|
||||
|
@ -96,12 +97,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Container>::fixed_container_type{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_container_traits<Container>::fixed_container_type
|
||||
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,
|
||||
|
@ -115,7 +116,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<std::size_t InitSize, typename Container, typename Generator, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type generate_impl_2(
|
||||
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,
|
||||
|
@ -136,7 +137,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_1(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
|
@ -150,7 +151,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type generate_impl_1(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
|
@ -165,7 +166,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Container, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type generate_impl(
|
||||
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,
|
||||
|
@ -179,7 +180,7 @@ namespace sprout {
|
|||
// generate
|
||||
//
|
||||
template<typename Container, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type generate(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type generate(
|
||||
Container const& cont,
|
||||
Generator gen,
|
||||
Inits const&... inits
|
||||
|
@ -188,6 +189,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#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 {
|
||||
|
@ -11,7 +12,7 @@ namespace sprout {
|
|||
// generate_n
|
||||
//
|
||||
template<typename Container, typename Size, typename Generator, typename... Inits>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type generate_n(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type generate_n(
|
||||
Container const& cont,
|
||||
Size n,
|
||||
Generator gen,
|
||||
|
@ -21,6 +22,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// inplace_merge
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type inplace_merge(
|
||||
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
|
||||
|
@ -31,7 +32,7 @@ namespace sprout {
|
|||
// inplace_merge
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type inplace_merge(
|
||||
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
|
||||
)
|
||||
|
@ -45,6 +46,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::inplace_merge;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_INPLACE_MERGE_HPP
|
||||
|
|
|
@ -5,13 +5,14 @@
|
|||
#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_container_traits<Container>::fixed_container_type make_heap_impl(
|
||||
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,
|
||||
|
@ -21,7 +22,7 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Container>::difference_type r = 2
|
||||
);
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type make_heap_impl_1(
|
||||
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,
|
||||
|
@ -42,7 +43,7 @@ namespace sprout {
|
|||
r * 2 + 1,
|
||||
r * 2 + 2
|
||||
)
|
||||
: sprout::get_fixed_copy(cont)
|
||||
: 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),
|
||||
|
@ -53,11 +54,11 @@ namespace sprout {
|
|||
l * 2 + 1,
|
||||
l * 2 + 2
|
||||
)
|
||||
: sprout::get_fixed_copy(cont)
|
||||
: sprout::clone(cont)
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type make_heap_impl(
|
||||
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,
|
||||
|
@ -68,11 +69,11 @@ namespace sprout {
|
|||
)
|
||||
{
|
||||
return r > size
|
||||
? sprout::get_fixed_copy(cont)
|
||||
? 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::get_fixed_copy(cont)
|
||||
: 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,
|
||||
|
@ -89,7 +90,7 @@ namespace sprout {
|
|||
// make_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type make_heap(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
|
@ -105,7 +106,7 @@ namespace sprout {
|
|||
// make_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type make_heap(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type make_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
|
@ -117,6 +118,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::make_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_MAKE_HEAP_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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>
|
||||
|
@ -14,7 +15,7 @@ namespace sprout {
|
|||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type make_partial_heap_impl_1(
|
||||
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,
|
||||
|
@ -39,11 +40,11 @@ namespace sprout {
|
|||
n + 1
|
||||
)
|
||||
: sprout::fixed::detail::make_partial_heap_impl_1(cont, comp, offset, size, middle_size, n + 1)
|
||||
: sprout::get_fixed_copy(cont)
|
||||
: sprout::clone(cont)
|
||||
;
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type make_partial_heap_impl(
|
||||
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,
|
||||
|
@ -52,7 +53,7 @@ namespace sprout {
|
|||
)
|
||||
{
|
||||
return sprout::fixed::detail::make_partial_heap_impl_1(
|
||||
::sprout::fixed::detail::make_heap_impl(cont, comp, offset, middle_size),
|
||||
sprout::fixed::detail::make_heap_impl(cont, comp, offset, middle_size),
|
||||
comp,
|
||||
offset,
|
||||
size,
|
||||
|
@ -65,7 +66,7 @@ namespace sprout {
|
|||
// make_partial_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type make_partial_heap(
|
||||
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
|
||||
|
@ -83,7 +84,7 @@ namespace sprout {
|
|||
// make_partial_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type make_partial_heap(
|
||||
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
|
||||
)
|
||||
|
@ -97,6 +98,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::make_partial_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_MAKE_PARTIAL_HEAP_HPP
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -13,18 +14,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type merge_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type merge_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -35,7 +36,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type merge_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -47,12 +48,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type merge_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -80,7 +81,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type merge_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -92,12 +93,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type merge_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -115,7 +116,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type merge_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type merge_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -131,7 +132,7 @@ namespace sprout {
|
|||
// merge
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type merge(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type merge(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -153,7 +154,7 @@ namespace sprout {
|
|||
// merge
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type merge(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type merge(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -171,6 +172,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::merge;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_MERGE_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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
|
||||
|
@ -13,7 +14,7 @@ namespace sprout {
|
|||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type nth_element_impl_1(
|
||||
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
|
||||
|
@ -26,7 +27,7 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type nth_element_impl(
|
||||
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,
|
||||
|
@ -45,7 +46,7 @@ namespace sprout {
|
|||
// nth_element
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type nth_element(
|
||||
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
|
||||
|
@ -63,7 +64,7 @@ namespace sprout {
|
|||
// nth_element
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type nth_element(
|
||||
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
|
||||
)
|
||||
|
@ -77,6 +78,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::nth_element;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_NTH_ELEMENT_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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
|
||||
|
@ -13,7 +14,7 @@ namespace sprout {
|
|||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type partial_sort_impl(
|
||||
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,
|
||||
|
@ -33,7 +34,7 @@ namespace sprout {
|
|||
// partial_sort
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type partial_sort(
|
||||
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
|
||||
|
@ -51,7 +52,7 @@ namespace sprout {
|
|||
// partial_sort
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type partial_sort(
|
||||
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
|
||||
)
|
||||
|
@ -65,6 +66,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::partial_sort;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_PARTIAL_SORT_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// partition
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type partition(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type partition(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
|
@ -20,6 +21,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -12,18 +13,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type partition_copy_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type partition_copy_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -34,7 +35,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type partition_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -44,12 +45,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type partition_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -69,7 +70,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type partition_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -79,12 +80,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type partition_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -100,7 +101,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type partition_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type partition_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -114,7 +115,7 @@ namespace sprout {
|
|||
// partition_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type partition_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type partition_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -124,6 +125,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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
|
||||
|
||||
|
@ -11,7 +12,7 @@ namespace sprout {
|
|||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type pop_heap_impl(
|
||||
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,
|
||||
|
@ -32,7 +33,7 @@ namespace sprout {
|
|||
r * 2 + 1,
|
||||
r * 2 + 2
|
||||
)
|
||||
: sprout::get_fixed_copy(cont)
|
||||
: sprout::clone(cont)
|
||||
: l < size
|
||||
? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + l))
|
||||
? sprout::fixed::detail::pop_heap_impl(
|
||||
|
@ -44,8 +45,8 @@ namespace sprout {
|
|||
l * 2 + 1,
|
||||
l * 2 + 2
|
||||
)
|
||||
: sprout::get_fixed_copy(cont)
|
||||
: sprout::get_fixed_copy(cont)
|
||||
: sprout::clone(cont)
|
||||
: sprout::clone(cont)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
|
@ -53,7 +54,7 @@ namespace sprout {
|
|||
// pop_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type pop_heap(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type pop_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
|
@ -69,7 +70,7 @@ namespace sprout {
|
|||
// pop_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type pop_heap(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type pop_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
|
@ -81,6 +82,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::pop_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_POP_HEAP_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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
|
||||
|
||||
|
@ -11,7 +12,7 @@ namespace sprout {
|
|||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type push_heap_impl(
|
||||
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,
|
||||
|
@ -25,7 +26,7 @@ namespace sprout {
|
|||
offset,
|
||||
(n - 1) / 2
|
||||
)
|
||||
: sprout::get_fixed_copy(cont)
|
||||
: sprout::clone(cont)
|
||||
;
|
||||
}
|
||||
} // namespace detail
|
||||
|
@ -33,7 +34,7 @@ namespace sprout {
|
|||
// push_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type push_heap(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type push_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
|
@ -49,7 +50,7 @@ namespace sprout {
|
|||
// push_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type push_heap(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type push_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
|
@ -61,6 +62,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::push_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_PUSH_HEAP_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// remove
|
||||
//
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type remove(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type remove(
|
||||
Container const& cont,
|
||||
T const& value
|
||||
)
|
||||
|
@ -20,6 +21,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -12,18 +13,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -34,7 +35,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -44,12 +45,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -69,7 +70,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -79,12 +80,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -100,7 +101,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type remove_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -114,7 +115,7 @@ namespace sprout {
|
|||
// remove_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type remove_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -124,6 +125,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -12,18 +13,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_if_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_if_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -34,7 +35,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_if_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -44,12 +45,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_if_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -69,7 +70,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_if_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -79,12 +80,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type remove_copy_if_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -100,7 +101,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type remove_copy_if_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy_if_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -114,7 +115,7 @@ namespace sprout {
|
|||
// remove_copy_if
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type remove_copy_if(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type remove_copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -124,6 +125,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// remove_if
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type remove_if(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type remove_if(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
|
@ -20,6 +21,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// replace
|
||||
//
|
||||
template<typename Container, typename T>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type replace(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type replace(
|
||||
Container const& cont,
|
||||
T const& old_value,
|
||||
T const& new_value
|
||||
|
@ -21,6 +22,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#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_container_traits<Result>::fixed_container_type replace_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -24,19 +25,21 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
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_container_traits<Result>::fixed_container_type replace_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -57,6 +60,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::replace_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REPLACE_COPY_HPP
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#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_container_traits<Result>::fixed_container_type replace_copy_if_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy_if_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -24,19 +25,21 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
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_container_traits<Result>::fixed_container_type replace_copy_if(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type replace_copy_if(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -57,6 +60,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::replace_copy_if;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_REPLACE_COPY_IF_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// replace_if
|
||||
//
|
||||
template<typename Container, typename T, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type replace_if(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type replace_if(
|
||||
Container const& cont,
|
||||
Predicate pred,
|
||||
T const& new_value
|
||||
|
@ -21,6 +22,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
26
sprout/algorithm/fixed/result_of.hpp
Normal file
26
sprout/algorithm/fixed/result_of.hpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#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
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,13 +13,15 @@ namespace sprout {
|
|||
// reverse
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type reverse(
|
||||
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
|
||||
|
|
|
@ -6,13 +6,15 @@
|
|||
#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_container_traits<Result>::fixed_container_type reverse_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type reverse_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -22,19 +24,21 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
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_container_traits<Result>::fixed_container_type reverse_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type reverse_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
|
@ -43,13 +47,16 @@ namespace sprout {
|
|||
return sprout::fixed::detail::reverse_copy_impl(
|
||||
first,
|
||||
last,
|
||||
result, typename sprout::index_range<0, sprout::fixed_container_traits<Result>::fixed_size>::type(),
|
||||
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
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// rotate
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type rotate(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type rotate(
|
||||
Container const& cont,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator middle
|
||||
)
|
||||
|
@ -20,6 +21,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#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_container_traits<Result>::fixed_container_type rotate_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type rotate_copy_impl(
|
||||
Iterator first,
|
||||
Iterator middle,
|
||||
Iterator last,
|
||||
|
@ -23,7 +24,9 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
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)
|
||||
|
@ -31,14 +34,14 @@ namespace sprout {
|
|||
)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
};
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// rotate_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type rotate_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type rotate_copy(
|
||||
Iterator first,
|
||||
Iterator middle,
|
||||
Iterator last,
|
||||
|
@ -57,6 +60,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::rotate_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_ROTATE_COPY_HPP
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -13,18 +14,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_difference_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_difference_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -35,7 +36,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_difference_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -47,12 +48,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_difference_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -82,7 +83,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_difference_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -94,12 +95,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_difference_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -117,7 +118,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_difference_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_difference_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -133,7 +134,7 @@ namespace sprout {
|
|||
// set_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_difference(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_difference(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -155,7 +156,7 @@ namespace sprout {
|
|||
// set_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_difference(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_difference(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -173,6 +174,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::set_difference;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SET_DIFFERENCE_HPP
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -13,18 +14,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_intersection_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_intersection_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -35,7 +36,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_intersection_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -47,12 +48,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_intersection_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -82,7 +83,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_intersection_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -94,12 +95,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_intersection_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -117,7 +118,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_intersection_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_intersection_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -133,7 +134,7 @@ namespace sprout {
|
|||
// set_intersection
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_intersection(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_intersection(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -155,7 +156,7 @@ namespace sprout {
|
|||
// set_intersection
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_intersection(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_intersection(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -173,6 +174,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::set_intersection;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SET_INTERSECTION_HPP
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -13,18 +14,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_symmetric_difference_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_symmetric_difference_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -35,7 +36,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_symmetric_difference_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -47,12 +48,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_symmetric_difference_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -82,7 +83,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_symmetric_difference_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -94,12 +95,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_symmetric_difference_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -117,7 +118,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_symmetric_difference_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_symmetric_difference_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -133,7 +134,7 @@ namespace sprout {
|
|||
// set_symmetric_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_symmetric_difference(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_symmetric_difference(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -155,7 +156,7 @@ namespace sprout {
|
|||
// set_symmetric_difference
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_symmetric_difference(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_symmetric_difference(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -173,6 +174,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::set_symmetric_difference;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SET_SYMMETRIC_DIFFERENCE_HPP
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -13,18 +14,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_union_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_union_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -35,7 +36,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_union_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -47,12 +48,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_union_impl_2(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -82,7 +83,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_union_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -94,12 +95,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type set_union_impl_1(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
|
@ -117,7 +118,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_union_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_union_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -133,7 +134,7 @@ namespace sprout {
|
|||
// set_union
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_union(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_union(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -155,7 +156,7 @@ namespace sprout {
|
|||
// set_union
|
||||
//
|
||||
template<typename Iterator1, typename Iterator2, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type set_union(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type set_union(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -173,6 +174,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::set_union;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SET_UNION_HPP
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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
|
||||
|
@ -42,33 +43,33 @@ namespace sprout {
|
|||
return comp(p, *(origin + r)) ? sort_find_r<Container>(origin, comp, r - 1, p) : r;
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type swap_lr(
|
||||
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_container_traits<Container>::fixed_container_type sort_part_l(
|
||||
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::get_fixed_copy(cont);
|
||||
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_container_traits<Container>::fixed_container_type sort_part_r(
|
||||
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::get_fixed_copy(cont);
|
||||
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_container_traits<Container>::fixed_container_type sort_part_lr(
|
||||
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,
|
||||
|
@ -80,7 +81,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type sort_next(
|
||||
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,
|
||||
|
@ -96,7 +97,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type sort_lr(
|
||||
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,
|
||||
|
@ -117,7 +118,7 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type sort_start(
|
||||
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,
|
||||
|
@ -133,18 +134,18 @@ namespace sprout {
|
|||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size <= 1),
|
||||
typename sprout::fixed_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::get_fixed_copy(cont);
|
||||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
|
@ -163,17 +164,17 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size <= 1),
|
||||
typename sprout::fixed_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type sort(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::get_fixed_copy(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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type sort(
|
||||
Container const& cont
|
||||
)
|
||||
|
@ -186,6 +187,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::sort;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SORT_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
namespace fixed {
|
||||
namespace detail {
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type sort_heap_impl(
|
||||
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,
|
||||
|
@ -20,7 +21,7 @@ namespace sprout {
|
|||
)
|
||||
{
|
||||
return size < 2
|
||||
? sprout::get_fixed_copy(cont)
|
||||
? 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),
|
||||
|
@ -39,7 +40,7 @@ namespace sprout {
|
|||
// sort_heap
|
||||
//
|
||||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type sort_heap(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_heap(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
|
@ -55,7 +56,7 @@ namespace sprout {
|
|||
// sort_heap
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type sort_heap(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type sort_heap(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
|
@ -67,6 +68,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::sort_heap;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SORT_HEAP_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// stable_partition
|
||||
//
|
||||
template<typename Container, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type stable_partition(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type stable_partition(
|
||||
Container const& cont,
|
||||
Predicate pred
|
||||
)
|
||||
|
@ -20,6 +21,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -12,18 +13,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type stable_partition_copy_impl_4(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type stable_partition_copy_impl_4(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -35,7 +36,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type stable_partition_copy_impl_3(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -45,12 +46,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type stable_partition_copy_impl_3(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -71,7 +72,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type stable_partition_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -82,12 +83,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type stable_partition_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -108,7 +109,7 @@ namespace sprout {
|
|||
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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type stable_partition_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -119,12 +120,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type stable_partition_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -141,7 +142,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type stable_partition_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type stable_partition_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -155,7 +156,7 @@ namespace sprout {
|
|||
// stable_partition_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename Predicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type stable_partition_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type stable_partition_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -165,6 +166,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#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 {
|
||||
|
@ -14,7 +15,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -25,17 +26,17 @@ namespace sprout {
|
|||
sprout::index_tuple<PostIndexes...>
|
||||
);
|
||||
template<typename Container, std::ptrdiff_t... Indexes>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type stable_sort_impl_finish(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type stable_sort_impl_finish(
|
||||
Container const& cont,
|
||||
sprout::index_tuple<Indexes...>
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Container>::fixed_container_type{(*(sprout::fixed_begin(cont) + 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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -54,7 +55,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -73,7 +74,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -92,7 +93,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_4(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -109,7 +110,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
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_container_traits<Container>::fixed_container_type stable_sort_impl_3(
|
||||
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...>,
|
||||
|
@ -122,7 +123,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_2(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -136,7 +137,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_2(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -150,7 +151,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_1(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -170,7 +171,7 @@ namespace sprout {
|
|||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort_impl_1(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
|
@ -188,7 +189,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Container, typename Compare, std::ptrdiff_t... Indexes>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type stable_sort_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type stable_sort_impl(
|
||||
Container const& cont,
|
||||
Compare comp,
|
||||
sprout::index_tuple<Indexes...>
|
||||
|
@ -203,18 +204,18 @@ namespace sprout {
|
|||
template<typename Container, typename Compare>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size <= 1),
|
||||
typename sprout::fixed_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
)
|
||||
{
|
||||
return sprout::get_fixed_copy(cont);
|
||||
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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort(
|
||||
Container const& cont,
|
||||
Compare comp
|
||||
|
@ -232,17 +233,17 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
(sprout::fixed_container_traits<Container>::fixed_size <= 1),
|
||||
typename sprout::fixed_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
return sprout::get_fixed_copy(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_container_traits<Container>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Container>::type
|
||||
>::type stable_sort(
|
||||
Container const& cont
|
||||
)
|
||||
|
@ -254,6 +255,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::stable_sort;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_STABLE_SORT_HPP
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#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 {
|
||||
|
@ -12,7 +13,7 @@ namespace sprout {
|
|||
// swap_element
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type swap_element(
|
||||
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
|
||||
|
@ -21,6 +22,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#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_container_traits<Result>::fixed_container_type swap_element_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type swap_element_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -24,7 +25,9 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
return sprout::remake_clone<Result, Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? first + Indexes - offset == pos1
|
||||
? *pos2
|
||||
|
@ -33,14 +36,14 @@ namespace sprout {
|
|||
: *(first + Indexes - offset)
|
||||
: *(sprout::fixed_begin(result) + Indexes)
|
||||
)...
|
||||
};
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// swap_element_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type swap_element_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type swap_element_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -61,6 +64,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::swap_element_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_SWAP_ELEMENT_COPY_HPP
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#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_container_traits<Result>::fixed_container_type transform_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type transform_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -23,19 +24,21 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
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_container_traits<Result>::fixed_container_type transform(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type transform(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -56,7 +59,7 @@ namespace sprout {
|
|||
|
||||
namespace detail {
|
||||
template<typename Iterator1, typename Iterator2, typename Result, std::ptrdiff_t... Indexes, typename BinaryOperation>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type transform_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type transform_impl(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -68,19 +71,21 @@ namespace sprout {
|
|||
typename sprout::fixed_container_traits<Result>::size_type input_size
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{
|
||||
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_container_traits<Result>::fixed_container_type transform(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type transform(
|
||||
Iterator1 first1,
|
||||
Iterator1 last1,
|
||||
Iterator2 first2,
|
||||
|
@ -101,6 +106,8 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::transform;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_TRANSFORM_HPP
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace sprout {
|
|||
// unique
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type unique(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type unique(
|
||||
Container const& cont
|
||||
)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ namespace sprout {
|
|||
// unique
|
||||
//
|
||||
template<typename Container, typename BinaryPredicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type unique(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Container>::type unique(
|
||||
Container const& cont,
|
||||
BinaryPredicate pred
|
||||
)
|
||||
|
@ -31,6 +31,8 @@ namespace sprout {
|
|||
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
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#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 {
|
||||
|
@ -12,18 +13,18 @@ namespace sprout {
|
|||
template<typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{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_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_3(
|
||||
Result const& result,
|
||||
Args const&... args
|
||||
|
@ -34,7 +35,7 @@ namespace sprout {
|
|||
template<typename Iterator, typename Result, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args) + 1,
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -44,12 +45,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{args..., head};
|
||||
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Iterator, typename Result, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args) + 1,
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -69,7 +70,7 @@ namespace sprout {
|
|||
template<typename Iterator, typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -78,12 +79,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{args...};
|
||||
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Iterator, typename Result, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -98,7 +99,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type unique_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type unique_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
|
@ -111,7 +112,7 @@ namespace sprout {
|
|||
// unique_copy
|
||||
//
|
||||
template<typename Iterator, typename Result>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type unique_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type unique_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result
|
||||
|
@ -124,7 +125,7 @@ namespace sprout {
|
|||
template<typename Iterator, typename Result, typename BinaryPredicate, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args) + 1,
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -135,12 +136,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{args..., head};
|
||||
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Iterator, typename Result, typename BinaryPredicate, typename Head, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args) + 1,
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_2(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -161,7 +162,7 @@ namespace sprout {
|
|||
template<typename Iterator, typename Result, typename BinaryPredicate, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size == sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -171,12 +172,12 @@ namespace sprout {
|
|||
Args const&... args
|
||||
)
|
||||
{
|
||||
return typename sprout::fixed_container_traits<Result>::fixed_container_type{args...};
|
||||
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...);
|
||||
}
|
||||
template<typename Iterator, typename Result, typename BinaryPredicate, typename... Args>
|
||||
SPROUT_CONSTEXPR inline typename std::enable_if<
|
||||
sprout::fixed_container_traits<Result>::fixed_size != sizeof...(Args),
|
||||
typename sprout::fixed_container_traits<Result>::fixed_container_type
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type unique_copy_impl_1(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
|
@ -192,7 +193,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator, typename Result, typename BinaryPredicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type unique_copy_impl(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type unique_copy_impl(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -206,7 +207,7 @@ namespace sprout {
|
|||
// unique_copy
|
||||
//
|
||||
template<typename Iterator, typename Result, typename BinaryPredicate>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Result>::fixed_container_type unique_copy(
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm<Result>::type unique_copy(
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
Result const& result,
|
||||
|
@ -216,6 +217,8 @@ namespace sprout {
|
|||
return sprout::fixed::detail::unique_copy_impl(first, last, result, pred);
|
||||
}
|
||||
} // namespace fixed
|
||||
|
||||
using sprout::fixed::unique_copy;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_UNIQUE_COPY_HPP
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/generate.hpp>
|
||||
#include <sprout/algorithm/outfit/generate.hpp>
|
||||
#include <sprout/algorithm/infit/generate.hpp>
|
||||
#include <sprout/algorithm/fit/generate.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_GENERATE_HPP
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/algorithm/fixed/generate_n.hpp>
|
||||
#include <sprout/algorithm/outfit/generate_n.hpp>
|
||||
#include <sprout/algorithm/infit/generate_n.hpp>
|
||||
#include <sprout/algorithm/fit/generate_n.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_GENERATE_N_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