mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
refix copy algorithm
This commit is contained in:
parent
4e4c1b1786
commit
1971e351e6
1 changed files with 4 additions and 62 deletions
|
@ -16,7 +16,6 @@
|
|||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/container/indexes.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/iterator/next_iterator.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
#include <sprout/math/comparison.hpp>
|
||||
|
@ -64,7 +63,7 @@ namespace sprout {
|
|||
sprout::container_traits<Result>::static_size == sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
copy_impl_fw(
|
||||
copy_impl(
|
||||
InputIterator, InputIterator, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type,
|
||||
Args const&... args
|
||||
|
@ -77,14 +76,14 @@ namespace sprout {
|
|||
sprout::container_traits<Result>::static_size != sizeof...(Args),
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
copy_impl_fw(
|
||||
copy_impl(
|
||||
InputIterator first, InputIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first != last && sizeof...(Args) < size
|
||||
? sprout::fixed::detail::copy_impl_fw(sprout::next(first), last, result, size, args..., *first)
|
||||
? sprout::fixed::detail::copy_impl(sprout::next(first), last, result, size, args..., *first)
|
||||
: sprout::detail::container_complate(result, args...)
|
||||
;
|
||||
}
|
||||
|
@ -92,67 +91,10 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
copy(
|
||||
InputIterator first, InputIterator last, Result const& result,
|
||||
std::forward_iterator_tag*
|
||||
)
|
||||
{
|
||||
return sprout::fixed::detail::copy_impl_fw(first, last, result, sprout::size(result));
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == sizeof...(Args) + 1,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
copy_impl_in(
|
||||
sprout::next_iterator<InputIterator> const& first, InputIterator, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result), args..., *first);
|
||||
}
|
||||
template<typename InputIterator, typename Result, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != sizeof...(Args) + 1,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
copy_impl_in(
|
||||
sprout::next_iterator<InputIterator> const& first, InputIterator last, Result const& result,
|
||||
typename sprout::container_traits<Result>::size_type size,
|
||||
Args const&... args
|
||||
)
|
||||
{
|
||||
return first.base() != last && sizeof...(Args) + 1 < size
|
||||
? sprout::fixed::detail::copy_impl_in(sprout::next(first), last, result, size, args..., *first)
|
||||
: sprout::detail::container_complate(result, args..., *first)
|
||||
;
|
||||
}
|
||||
template<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size == 0,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
copy(
|
||||
InputIterator, InputIterator, Result const& result,
|
||||
std::input_iterator_tag*
|
||||
)
|
||||
{
|
||||
return sprout::remake<Result>(result, sprout::size(result));
|
||||
}
|
||||
template<typename InputIterator, typename Result>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::container_traits<Result>::static_size != 0,
|
||||
typename sprout::fixed::result_of::algorithm<Result>::type
|
||||
>::type
|
||||
copy(
|
||||
InputIterator first, InputIterator last, Result const& result,
|
||||
std::input_iterator_tag*
|
||||
)
|
||||
{
|
||||
return first != last
|
||||
? sprout::fixed::detail::copy_impl_in(sprout::make_next_iterator(first), last, result, sprout::size(result))
|
||||
: sprout::detail::container_complate(result)
|
||||
;
|
||||
return sprout::fixed::detail::copy_impl(first, last, result, sprout::size(result));
|
||||
}
|
||||
|
||||
template<typename InputIterator, typename Result>
|
||||
|
|
Loading…
Reference in a new issue