mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-05-10 09:23:30 +00:00
add back_inserter, front_inserter
This commit is contained in:
parent
7c706381d4
commit
74e83e31a7
70 changed files with 1094 additions and 186 deletions
|
@ -56,6 +56,8 @@
|
|||
#include <sprout/algorithm/fit/copy_until.hpp>
|
||||
#include <sprout/algorithm/fit/clamp_range.hpp>
|
||||
#include <sprout/algorithm/fit/clamp_range_copy.hpp>
|
||||
#include <sprout/algorithm/fit/swap_element.hpp>
|
||||
#include <sprout/algorithm/fit/swap_element_copy.hpp>
|
||||
#include <sprout/algorithm/fit/random_swap.hpp>
|
||||
#include <sprout/algorithm/fit/random_swap_result.hpp>
|
||||
#include <sprout/algorithm/fit/bogo_sort.hpp>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -28,7 +27,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::clamp_range_copy(first, last, result, low, high, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
@ -61,7 +60,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::clamp_range_copy(first, last, result, low, high)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -25,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::copy(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -23,7 +22,7 @@ namespace sprout {
|
|||
{
|
||||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::copy_backward(first, last, result)),
|
||||
offset - NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result)),
|
||||
offset - sprout::fit_size(result, sprout::distance(first, last)),
|
||||
offset
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/count_if.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -24,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::copy_if(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::count_if(first, last, pred), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::count_if(first, last, pred))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -23,7 +22,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::copy_n(first, n, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::size(result))
|
||||
offset + sprout::fit_size(result, n)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -5,12 +5,11 @@
|
|||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/find_if.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_while.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/algorithm/find_if.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -26,10 +25,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::copy_until(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first, sprout::find_if(first, last, pred)),
|
||||
sprout::size(result)
|
||||
)
|
||||
offset + sprout::fit_size(result, sprout::distance(first, sprout::find_if(first, last, pred)))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -5,12 +5,11 @@
|
|||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/find_if_not.hpp>
|
||||
#include <sprout/algorithm/fixed/copy_while.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/algorithm/find_if_not.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -26,10 +25,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::copy_while(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first, sprout::find_if_not(first, last, pred)),
|
||||
sprout::size(result)
|
||||
)
|
||||
offset + sprout::fit_size(result, sprout::distance(first, sprout::find_if_not(first, last, pred)))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -27,10 +26,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::merge(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first1, last1) + sprout::distance(first2, last2),
|
||||
sprout::size(result)
|
||||
)
|
||||
offset + sprout::fit_size(result, sprout::distance(first1, last1) + sprout::distance(first2, last2))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
@ -65,10 +61,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::merge(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first1, last1) + sprout::distance(first2, last2),
|
||||
sprout::size(result)
|
||||
)
|
||||
offset + sprout::fit_size(result, sprout::distance(first1, last1) + sprout::distance(first2, last2))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/count_if.hpp>
|
||||
#include <sprout/algorithm/fixed/partition.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -23,7 +23,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::partition(cont, pred)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
offset + sprout::size(cont) - sprout::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/detail/algorithm/count_n_if.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -27,12 +26,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::partition_copy(first, last, result, pred)),
|
||||
offset,
|
||||
offset + sprout::detail::count_n_if(
|
||||
first,
|
||||
NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first, last), sprout::size(result)
|
||||
),
|
||||
pred
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::detail::count_n_if(first, NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result)), pred)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/fixed/remove.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/algorithm/count.hpp>
|
||||
#include <sprout/algorithm/fixed/remove.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -23,7 +23,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::remove(cont, value)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT::count(sprout::begin(cont), sprout::end(cont), value)
|
||||
offset + sprout::size(cont) - sprout::count(sprout::begin(cont), sprout::end(cont), value)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/count.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -25,10 +25,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::remove_copy(first, last, result, value)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first, last) - NS_SSCRISK_CEL_OR_SPROUT::count(first, last, value),
|
||||
sprout::size(result)
|
||||
)
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last) - sprout::count(first, last, value))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/count_if.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_copy_if.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -25,10 +25,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::remove_copy_if(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first, last) - NS_SSCRISK_CEL_OR_SPROUT::count_if(first, last, pred),
|
||||
sprout::size(result)
|
||||
)
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last) - sprout::count_if(first, last, pred))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/count_if.hpp>
|
||||
#include <sprout/algorithm/fixed/remove_if.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -23,7 +23,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::remove_if(cont, pred)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
offset + sprout::size(cont) - sprout::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -25,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::replace_copy(first, last, result, old_value, new_value)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -25,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::replace_copy_if(first, last, result, pred, new_value)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -24,7 +23,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::reverse_copy(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -24,7 +23,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::rotate_copy(first, middle, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/detail/algorithm/set_overlap_count.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -28,11 +27,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::set_difference(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first1, last1)
|
||||
- sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
|
||||
,
|
||||
sprout::size(result)
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::distance(first1, last1) - sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -68,11 +64,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::set_difference(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first1, last1)
|
||||
- sprout::detail::set_overlap_count(first1, last1, first2, last2)
|
||||
,
|
||||
sprout::size(result)
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::distance(first1, last1) - sprout::detail::set_overlap_count(first1, last1, first2, last2)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/detail/algorithm/set_overlap_count.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -27,9 +26,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::set_intersection(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::detail::set_overlap_count(first1, last1, first2, last2, comp),
|
||||
sprout::size(result)
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -65,9 +63,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::set_intersection(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::detail::set_overlap_count(first1, last1, first2, last2),
|
||||
sprout::size(result)
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::detail::set_overlap_count(first1, last1, first2, last2)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/detail/algorithm/set_overlap_count.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -28,11 +27,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first1, last1) + sprout::distance(first2, last2)
|
||||
- 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
|
||||
,
|
||||
sprout::size(result)
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::distance(first1, last1) + sprout::distance(first2, last2) - 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -68,12 +64,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::set_symmetric_difference(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first1, last1)
|
||||
+ sprout::distance(first2, last2)
|
||||
- 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2)
|
||||
,
|
||||
sprout::size(result)
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::distance(first1, last1) + sprout::distance(first2, last2) - 2 * sprout::detail::set_overlap_count(first1, last1, first2, last2)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/detail/algorithm/set_overlap_count.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -28,11 +27,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::set_union(first1, last1, first2, last2, result, comp)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first1, last1) + sprout::distance(first2, last2)
|
||||
- sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
|
||||
,
|
||||
sprout::size(result)
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::distance(first1, last1) + sprout::distance(first2, last2) - sprout::detail::set_overlap_count(first1, last1, first2, last2, comp)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -68,11 +64,8 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::set_union(first1, last1, first2, last2, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first1, last1) + sprout::distance(first2, last2)
|
||||
- sprout::detail::set_overlap_count(first1, last1, first2, last2)
|
||||
,
|
||||
sprout::size(result)
|
||||
offset + sprout::fit_size(
|
||||
result, sprout::distance(first1, last1) + sprout::distance(first2, last2) - sprout::detail::set_overlap_count(first1, last1, first2, last2)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/count_if.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_partition.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -23,7 +23,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::stable_partition(cont, pred)),
|
||||
offset,
|
||||
offset + sprout::size(cont) - NS_SSCRISK_CEL_OR_SPROUT::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
offset + sprout::size(cont) - sprout::count_if(sprout::begin(cont), sprout::end(cont), pred)
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/algorithm/count_if.hpp>
|
||||
#include <sprout/algorithm/fixed/stable_partition_copy.hpp>
|
||||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -24,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::stable_partition_copy(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(NS_SSCRISK_CEL_OR_SPROUT::count_if(first, last, pred), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::count_if(first, last, pred))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -24,7 +23,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::swap_element_copy(first, last, result, pos1, pos2)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -25,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::transform(first, last, result, op)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
@ -50,7 +49,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::transform(first1, last1, first2, result, op)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first1, last1), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first1, last1))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/detail/algorithm/overlap_count.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -26,10 +25,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::unique_copy(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first, last) - sprout::detail::overlap_count(first, last),
|
||||
sprout::size(result)
|
||||
)
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last) - sprout::detail::overlap_count(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
@ -54,10 +50,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::unique_copy(first, last, result, pred)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(
|
||||
sprout::distance(first, last) - sprout::detail::overlap_count(first, last, pred),
|
||||
sprout::size(result)
|
||||
)
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last) - sprout::detail::overlap_count(first, last, pred))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR array fill(const_reference value) const {
|
||||
return fill_impl(value, sprout::index_n<0, N>::make());
|
||||
}
|
||||
void swap(array<T, N>& other)
|
||||
void swap(array& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::swap(std::declval<T&>(), std::declval<T&>())))
|
||||
{
|
||||
std::swap_ranges(other.begin(), other.end(), begin());
|
||||
|
@ -176,12 +176,12 @@ namespace sprout {
|
|||
}
|
||||
// others:
|
||||
template<typename T2>
|
||||
array<T, N>& operator=(array<T2, N> const& rhs) {
|
||||
array& operator=(array<T2, N> const& rhs) {
|
||||
std::copy(rhs.begin(), rhs.end(), begin());
|
||||
return *this;
|
||||
}
|
||||
template<typename T2>
|
||||
array<T, N>& operator=(array<T2, N>&& rhs) {
|
||||
array& operator=(array<T2, N>&& rhs) {
|
||||
std::move(rhs.begin(), rhs.end(), begin());
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@ namespace sprout {
|
|||
T im_;
|
||||
public:
|
||||
SPROUT_CONSTEXPR complex(T const& re = T(), T const& im = T()) SPROUT_NOEXCEPT
|
||||
: re_(re) , im_(im)
|
||||
: re_(re), im_(im)
|
||||
{}
|
||||
SPROUT_CONSTEXPR complex(complex const&) = default;
|
||||
template<typename X>
|
||||
SPROUT_CONSTEXPR complex(complex<X> const& other) SPROUT_NOEXCEPT
|
||||
: re_(other.real()) , im_(other.imag())
|
||||
: re_(other.real()), im_(other.imag())
|
||||
{}
|
||||
SPROUT_CONSTEXPR T real() const SPROUT_NOEXCEPT {
|
||||
return re_;
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace sprout {
|
|||
distort_holder() = default;
|
||||
distort_holder(distort_holder const&) = default;
|
||||
SPROUT_CONSTEXPR distort_holder(value_type const& gain, value_type const& level)
|
||||
: gain_(gain) , level_(level)
|
||||
: gain_(gain), level_(level)
|
||||
{}
|
||||
SPROUT_CONSTEXPR value_type const& gain() const {
|
||||
return gain_;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace sprout {
|
|||
fuzz_holder() = default;
|
||||
fuzz_holder(fuzz_holder const&) = default;
|
||||
SPROUT_CONSTEXPR fuzz_holder(value_type const& gain, value_type const& level)
|
||||
: gain_(gain) , level_(level)
|
||||
: gain_(gain), level_(level)
|
||||
{}
|
||||
SPROUT_CONSTEXPR value_type const& gain() const {
|
||||
return gain_;
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace sprout {
|
|||
overdrive_holder() = default;
|
||||
overdrive_holder(overdrive_holder const&) = default;
|
||||
SPROUT_CONSTEXPR overdrive_holder(value_type const& gain, value_type const& level)
|
||||
: gain_(gain) , level_(level)
|
||||
: gain_(gain), level_(level)
|
||||
{}
|
||||
SPROUT_CONSTEXPR value_type const& gain() const {
|
||||
return gain_;
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/metafunctions.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/container/utility.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_CONTAINER_HPP
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace sprout {
|
|||
}
|
||||
template<typename Container, typename Cont, typename... Args>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
!sprout::is_fixed_container<Container>::value,
|
||||
!sprout::is_fixed_container<Container>::value && sizeof...(Args) != 2,
|
||||
typename sprout::container_construct_traits<Container>::copied_type
|
||||
>::type
|
||||
default_remake_container(Cont&& cont, typename sprout::container_traits<Container>::difference_type size, Args&&... args) {
|
||||
|
|
29
sprout/container/container_fitness_traits.hpp
Normal file
29
sprout/container/container_fitness_traits.hpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef SPROUT_CONTAINER_CONTAINER_FITNESS_TRAITS_HPP
|
||||
#define SPROUT_CONTAINER_CONTAINER_FITNESS_TRAITS_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/container_traits.hpp>
|
||||
#include <sprout/container/size.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// container_fitness_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct container_fitness_traits {
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR typename sprout::container_traits<Container>::difference_type
|
||||
fit_size(Cont&& cont, typename sprout::container_traits<Container>::difference_type size) {
|
||||
return NS_SSCRISK_CEL_OR_SPROUT::min(size, sprout::size(sprout::forward<Cont>(cont)));
|
||||
}
|
||||
};
|
||||
template<typename Container>
|
||||
struct container_fitness_traits<Container const>
|
||||
: public sprout::container_fitness_traits<Container>
|
||||
{};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_CONTAINER_CONTAINER_FITNESS_TRAITS_HPP
|
152
sprout/container/container_holder.hpp
Normal file
152
sprout/container/container_holder.hpp
Normal file
|
@ -0,0 +1,152 @@
|
|||
#ifndef SPROUT_CONTAINER_CONTAINER_HOLDER_HPP
|
||||
#define SPROUT_CONTAINER_CONTAINER_HOLDER_HPP
|
||||
|
||||
#include <utility>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/value_holder/value_holder.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// container_holder
|
||||
//
|
||||
template<typename Container>
|
||||
class container_holder
|
||||
: public sprout::container_traits_facade<Container>
|
||||
{
|
||||
private:
|
||||
typedef sprout::container_traits_facade<Container> facade_type;
|
||||
public:
|
||||
typedef Container container_type;
|
||||
typedef container_type internal_type;
|
||||
typedef typename facade_type::iterator iterator;
|
||||
typedef typename facade_type::const_iterator const_iterator;
|
||||
typedef typename facade_type::reference reference;
|
||||
typedef typename facade_type::const_reference const_reference;
|
||||
typedef typename facade_type::size_type size_type;
|
||||
typedef typename facade_type::difference_type difference_type;
|
||||
typedef typename facade_type::pointer pointer;
|
||||
typedef typename facade_type::const_pointer const_pointer;
|
||||
typedef internal_type& param_type;
|
||||
typedef internal_type const& const_param_type;
|
||||
typedef sprout::value_holder<param_type> holder_type;
|
||||
protected:
|
||||
holder_type container;
|
||||
public:
|
||||
SPROUT_CONSTEXPR container_holder()
|
||||
: container()
|
||||
{}
|
||||
explicit SPROUT_CONSTEXPR container_holder(param_type x)
|
||||
: container(x)
|
||||
{}
|
||||
SPROUT_CONSTEXPR container_holder(container_holder const&) = default;
|
||||
|
||||
void swap(container_holder& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(other.container, container)))
|
||||
{
|
||||
sprout::swap(other.container, container);
|
||||
}
|
||||
// iterators:
|
||||
iterator begin() {
|
||||
return sprout::begin(*container);
|
||||
}
|
||||
SPROUT_CONSTEXPR const_iterator begin() const {
|
||||
return sprout::begin(*container);
|
||||
}
|
||||
iterator end() {
|
||||
return sprout::end(*container);
|
||||
}
|
||||
SPROUT_CONSTEXPR const_iterator end() const {
|
||||
return sprout::end(*container);
|
||||
}
|
||||
SPROUT_CONSTEXPR const_iterator cbegin() const {
|
||||
return sprout::begin(*container);
|
||||
}
|
||||
SPROUT_CONSTEXPR const_iterator cend() const {
|
||||
return sprout::end(*container);
|
||||
}
|
||||
// capacity:
|
||||
SPROUT_CONSTEXPR size_type size() const SPROUT_NOEXCEPT {
|
||||
return sprout::size(*container);
|
||||
}
|
||||
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT {
|
||||
return sprout::empty(*container);
|
||||
}
|
||||
|
||||
param_type get_internal() {
|
||||
return *container;
|
||||
}
|
||||
SPROUT_CONSTEXPR const_param_type get_internal() const {
|
||||
return *container;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// swap
|
||||
//
|
||||
template<typename Container>
|
||||
inline void
|
||||
swap(sprout::container_holder<Container>& lhs, sprout::container_holder<Container>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
//
|
||||
// container_construct_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct container_construct_traits<sprout::container_holder<Container> > {
|
||||
public:
|
||||
typedef typename sprout::container_construct_traits<Container>::copied_type copied_type;
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
deep_copy(Cont&& cont) {
|
||||
return sprout::deep_copy(sprout::get_internal(sprout::forward<Cont>(cont)));
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
make(Args&&... args) {
|
||||
return sprout::make<copied_type>(sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake(Cont&& cont, typename sprout::container_traits<Container>::difference_type size, Args&&... args) {
|
||||
return sprout::remake<copied_type>(sprout::get_internal(sprout::forward<Cont>(cont)), size, sprout::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// sub_container_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct sub_container_traits<sprout::container_holder<Container> > {
|
||||
private:
|
||||
static typename sprout::container_holder<Container>::param_type
|
||||
call(sprout::container_holder<Container>& cont) {
|
||||
return cont.get_internal();
|
||||
}
|
||||
static SPROUT_CONSTEXPR typename sprout::container_holder<Container>::const_param_type
|
||||
call(sprout::container_holder<Container> const& cont) {
|
||||
return cont.get_internal();
|
||||
}
|
||||
public:
|
||||
template<typename Cont>
|
||||
struct internal {
|
||||
public:
|
||||
typedef decltype(call(std::declval<Cont&&>())) type;
|
||||
};
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR typename internal<Cont>::type
|
||||
get_internal(Cont&& cont) {
|
||||
return call(sprout::forward<Cont>(cont));
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_CONTAINER_CONTAINER_HOLDER_HPP
|
37
sprout/container/deep_internal.hpp
Normal file
37
sprout/container/deep_internal.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef SPROUT_CONTAINER_DEEP_INTERNAL_HPP
|
||||
#define SPROUT_CONTAINER_DEEP_INTERNAL_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/internal.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace containers {
|
||||
namespace detail {
|
||||
template<typename Container, typename Prev, typename = void>
|
||||
struct deep_internal_impl
|
||||
: public sprout::containers::detail::deep_internal_impl<
|
||||
typename sprout::containers::internal<Container>::type, Container
|
||||
>
|
||||
{};
|
||||
template<typename Container, typename Prev>
|
||||
struct deep_internal_impl<
|
||||
Container, Prev,
|
||||
typename std::enable_if<std::is_same<Container, Prev&&>::value>::type
|
||||
>
|
||||
: public std::common_type<Container>
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
// deep_internal
|
||||
//
|
||||
template<typename Container>
|
||||
struct deep_internal
|
||||
: public sprout::containers::detail::deep_internal_impl<
|
||||
typename sprout::containers::internal<Container>::type, Container
|
||||
>
|
||||
{};
|
||||
} // namespace containers
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_CONTAINER_DEEP_INTERNAL_HPP
|
22
sprout/container/fit_size.hpp
Normal file
22
sprout/container/fit_size.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_FIT_SIZE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_FIT_SIZE_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/container_traits.hpp>
|
||||
#include <sprout/container/container_fitness_traits.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fit_size
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<typename std::remove_reference<Container>::type>::difference_type
|
||||
fit_size(Container&& cont, typename sprout::container_traits<typename std::remove_reference<Container>::type>::difference_type size) {
|
||||
typedef typename std::remove_reference<Container>::type container_type;
|
||||
return sprout::container_fitness_traits<container_type>::fit_size(sprout::forward<Container>(cont), size);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_FIT_SIZE_HPP
|
|
@ -10,7 +10,9 @@
|
|||
#include <sprout/container/deep_copy.hpp>
|
||||
#include <sprout/container/make.hpp>
|
||||
#include <sprout/container/remake.hpp>
|
||||
#include <sprout/container/fit_size.hpp>
|
||||
#include <sprout/container/get_internal.hpp>
|
||||
#include <sprout/container/get_deep_internal.hpp>
|
||||
#include <sprout/container/internal_begin.hpp>
|
||||
#include <sprout/container/internal_end.hpp>
|
||||
#include <sprout/container/internal_size.hpp>
|
||||
|
|
43
sprout/container/get_deep_internal.hpp
Normal file
43
sprout/container/get_deep_internal.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_GET_DEEP_INTERNAL_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_GET_DEEP_INTERNAL_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/get_internal.hpp>
|
||||
#include <sprout/container/deep_internal.hpp>
|
||||
#include <sprout/container/is_sub_container.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/type_traits/enabler_if.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace detail {
|
||||
template<
|
||||
typename Container,
|
||||
typename sprout::enabler_if<!sprout::containers::is_sub_container<Container>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::containers::deep_internal<Container>::type
|
||||
get_deep_internal_impl(Container&& cont) {
|
||||
return sprout::forward<Container>(cont);
|
||||
}
|
||||
template<
|
||||
typename Container,
|
||||
typename sprout::enabler_if<sprout::containers::is_sub_container<Container>::value>::type = sprout::enabler
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::containers::deep_internal<Container>::type
|
||||
get_deep_internal_impl(Container&& cont) {
|
||||
return sprout::detail::get_deep_internal_impl(
|
||||
sprout::get_internal(sprout::forward<Container>(cont))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
//
|
||||
// get_deep_internal
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::containers::deep_internal<Container>::type
|
||||
get_deep_internal(Container&& cont) {
|
||||
return sprout::detail::get_deep_internal_impl(sprout::forward<Container>(cont));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_GET_DEEP_INTERNAL_HPP
|
|
@ -5,9 +5,9 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/container_traits.hpp>
|
||||
#include <sprout/container/sub_container_traits.hpp>
|
||||
#include <sprout/container/internal.hpp>
|
||||
#include <sprout/container/deep_internal.hpp>
|
||||
#include <sprout/container/begin.hpp>
|
||||
#include <sprout/container/get_internal.hpp>
|
||||
#include <sprout/container/get_deep_internal.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -16,20 +16,20 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
typename sprout::container_traits<
|
||||
typename std::remove_reference<
|
||||
typename sprout::containers::internal<Container&>::type
|
||||
typename sprout::containers::deep_internal<Container&>::type
|
||||
>::type
|
||||
>::iterator
|
||||
internal_begin(Container& cont) {
|
||||
return sprout::begin(sprout::get_internal(cont));
|
||||
return sprout::begin(sprout::get_deep_internal(cont));
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<
|
||||
typename std::remove_reference<
|
||||
typename sprout::containers::internal<Container const&>::type
|
||||
typename sprout::containers::deep_internal<Container const&>::type
|
||||
>::type
|
||||
>::const_iterator
|
||||
internal_begin(Container const& cont) {
|
||||
return sprout::begin(sprout::get_internal(cont));
|
||||
return sprout::begin(sprout::get_deep_internal(cont));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -38,11 +38,11 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<
|
||||
typename std::remove_reference<
|
||||
typename sprout::containers::internal<Container const&>::type
|
||||
typename sprout::containers::deep_internal<Container const&>::type
|
||||
>::type
|
||||
>::const_iterator
|
||||
internal_cbegin(Container const& cont) {
|
||||
return sprout::begin(sprout::get_internal(cont));
|
||||
return sprout::begin(sprout::get_deep_internal(cont));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/container_construct_traits.hpp>
|
||||
#include <sprout/container/sub_container_traits.hpp>
|
||||
#include <sprout/container/internal.hpp>
|
||||
#include <sprout/container/deep_internal.hpp>
|
||||
#include <sprout/container/deep_copy.hpp>
|
||||
#include <sprout/container/get_internal.hpp>
|
||||
#include <sprout/container/get_deep_internal.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -17,12 +17,12 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_construct_traits<
|
||||
typename std::remove_reference<
|
||||
typename sprout::containers::internal<Container>::type
|
||||
typename sprout::containers::deep_internal<Container>::type
|
||||
>::type
|
||||
>::copied_type
|
||||
internal_deep_copy(Container&& cont) {
|
||||
return sprout::deep_copy(
|
||||
sprout::get_internal(sprout::forward<Container>(cont))
|
||||
sprout::get_deep_internal(sprout::forward<Container>(cont))
|
||||
);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/container_traits.hpp>
|
||||
#include <sprout/container/sub_container_traits.hpp>
|
||||
#include <sprout/container/internal.hpp>
|
||||
#include <sprout/container/deep_internal.hpp>
|
||||
#include <sprout/container/end.hpp>
|
||||
#include <sprout/container/get_internal.hpp>
|
||||
#include <sprout/container/get_deep_internal.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -16,20 +16,20 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
typename sprout::container_traits<
|
||||
typename std::remove_reference<
|
||||
typename sprout::containers::internal<Container&>::type
|
||||
typename sprout::containers::deep_internal<Container&>::type
|
||||
>::type
|
||||
>::iterator
|
||||
internal_end(Container& cont) {
|
||||
return sprout::end(sprout::get_internal(cont));
|
||||
return sprout::end(sprout::get_deep_internal(cont));
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<
|
||||
typename std::remove_reference<
|
||||
typename sprout::containers::internal<Container const&>::type
|
||||
typename sprout::containers::deep_internal<Container const&>::type
|
||||
>::type
|
||||
>::const_iterator
|
||||
internal_end(Container const& cont) {
|
||||
return sprout::end(sprout::get_internal(cont));
|
||||
return sprout::end(sprout::get_deep_internal(cont));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -38,11 +38,11 @@ namespace sprout {
|
|||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename sprout::container_traits<
|
||||
typename std::remove_reference<
|
||||
typename sprout::containers::internal<Container const&>::type
|
||||
typename sprout::containers::deep_internal<Container const&>::type
|
||||
>::type
|
||||
>::const_iterator
|
||||
internal_cend(Container const& cont) {
|
||||
return sprout::end(sprout::get_internal(cont));
|
||||
return sprout::end(sprout::get_deep_internal(cont));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
|
|
23
sprout/container/is_sub_container.hpp
Normal file
23
sprout/container/is_sub_container.hpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef SPROUT_CONTAINER_IS_SUB_CONTAINER_HPP
|
||||
#define SPROUT_CONTAINER_IS_SUB_CONTAINER_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/internal.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace containers {
|
||||
//
|
||||
// is_sub_container
|
||||
//
|
||||
template<typename Container>
|
||||
struct is_sub_container
|
||||
: public std::integral_constant<
|
||||
bool,
|
||||
!std::is_same<typename sprout::containers::internal<Container>::type, Container&&>::value
|
||||
>
|
||||
{};
|
||||
} // namespace containers
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_CONTAINER_IS_SUB_CONTAINER_HPP
|
|
@ -16,6 +16,8 @@
|
|||
#include <sprout/container/rebind_size.hpp>
|
||||
#include <sprout/container/weak_rebind_size.hpp>
|
||||
#include <sprout/container/internal.hpp>
|
||||
#include <sprout/container/deep_internal.hpp>
|
||||
#include <sprout/container/is_sub_container.hpp>
|
||||
#include <sprout/container/indexes.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_CONTAINER_METAFUNCTIONS_HPP
|
||||
|
|
|
@ -18,7 +18,8 @@ namespace sprout {
|
|||
};
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR typename internal<Cont>::type get_internal(Cont&& cont) {
|
||||
static SPROUT_CONSTEXPR typename internal<Cont>::type
|
||||
get_internal(Cont&& cont) {
|
||||
return sprout::forward<Cont>(cont);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <sprout/container/container_traits.hpp>
|
||||
#include <sprout/container/container_construct_traits.hpp>
|
||||
#include <sprout/container/container_transform_traits.hpp>
|
||||
#include <sprout/container/container_fitness_traits.hpp>
|
||||
#include <sprout/container/sub_container_traits.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_CONTAINER_TRAITS_HPP
|
||||
|
|
7
sprout/container/utility.hpp
Normal file
7
sprout/container/utility.hpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef SPROUT_CONTAINER_UTILITY_HPP
|
||||
#define SPROUT_CONTAINER_UTILITY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/container_holder.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_CONTAINER_UTILITY_HPP
|
|
@ -21,6 +21,7 @@
|
|||
#include <sprout/iterator/indexed_iterator.hpp>
|
||||
#include <sprout/iterator/valued_iterator.hpp>
|
||||
#include <sprout/iterator/joint_iterator.hpp>
|
||||
#include <sprout/iterator/insert_range_iterator.hpp>
|
||||
#include <sprout/iterator/alternate_iterator.hpp>
|
||||
#include <sprout/iterator/size_enum_iterator.hpp>
|
||||
#include <sprout/iterator/bytes_iterator.hpp>
|
||||
|
|
166
sprout/iterator/back_insert_iterator.hpp
Normal file
166
sprout/iterator/back_insert_iterator.hpp
Normal file
|
@ -0,0 +1,166 @@
|
|||
#ifndef SPROUT_ITERATOR_BACK_INSERT_ITERATOR_HPP
|
||||
#define SPROUT_ITERATOR_BACK_INSERT_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/iterator/insert_range_iterator.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/container/container_holder.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/move.hpp>
|
||||
#include <sprout/utility/limited.hpp>
|
||||
#include <sprout/type_traits/arithmetic_promote.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// back_insert_iterator
|
||||
//
|
||||
template<typename Container>
|
||||
class back_insert_iterator
|
||||
: public std::iterator<std::output_iterator_tag, void, void, void, void>
|
||||
, public sprout::container_holder<Container>
|
||||
{
|
||||
private:
|
||||
typedef sprout::container_holder<Container> base_type;
|
||||
public:
|
||||
typedef typename base_type::container_type container_type;
|
||||
typedef typename base_type::internal_type internal_type;
|
||||
typedef typename base_type::iterator iterator;
|
||||
typedef typename base_type::const_iterator const_iterator;
|
||||
typedef typename base_type::reference reference;
|
||||
typedef typename base_type::const_reference const_reference;
|
||||
typedef typename base_type::size_type size_type;
|
||||
typedef typename base_type::difference_type difference_type;
|
||||
typedef typename base_type::pointer pointer;
|
||||
typedef typename base_type::const_pointer const_pointer;
|
||||
typedef typename base_type::param_type param_type;
|
||||
typedef typename base_type::const_param_type const_param_type;
|
||||
typedef typename base_type::holder_type holder_type;
|
||||
protected:
|
||||
using base_type::container;
|
||||
public:
|
||||
SPROUT_CONSTEXPR back_insert_iterator() = default;
|
||||
explicit SPROUT_CONSTEXPR back_insert_iterator(param_type x)
|
||||
: base_type(x)
|
||||
{}
|
||||
SPROUT_CONSTEXPR back_insert_iterator(back_insert_iterator const&) = default;
|
||||
back_insert_iterator& operator=(typename container_type::value_type const& value) {
|
||||
container->push_back(value);
|
||||
return *this;
|
||||
}
|
||||
back_insert_iterator& operator=(typename container_type::value_type&& value) {
|
||||
container->push_back(sprout::move(value));
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CONSTEXPR back_insert_iterator const& operator*() const {
|
||||
return *this;
|
||||
}
|
||||
back_insert_iterator& operator*() {
|
||||
return *this;
|
||||
}
|
||||
back_insert_iterator& operator++() {
|
||||
return *this;
|
||||
}
|
||||
back_insert_iterator operator++(int) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(back_insert_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(base_type::swap(other)))
|
||||
{
|
||||
base_type::swap(other);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// swap
|
||||
//
|
||||
template<typename Container>
|
||||
inline void
|
||||
swap(sprout::back_insert_iterator<Container>& lhs, sprout::back_insert_iterator<Container>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
//
|
||||
// back_inserter
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::back_insert_iterator<Container>
|
||||
back_inserter(Container& x) {
|
||||
return sprout::back_insert_iterator<Container>(x);
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::back_insert_iterator<Container const>
|
||||
back_inserter(Container const& x) {
|
||||
return sprout::back_insert_iterator<Container const>(x);
|
||||
}
|
||||
|
||||
//
|
||||
// container_construct_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct container_construct_traits<sprout::back_insert_iterator<Container> > {
|
||||
public:
|
||||
typedef typename sprout::container_construct_traits<Container>::copied_type copied_type;
|
||||
private:
|
||||
template<typename Cont, typename InputIterator>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake_impl(Cont&& cont, typename sprout::container_traits<Container>::difference_type size, InputIterator first, InputIterator last) {
|
||||
return sprout::make<copied_type>(
|
||||
sprout::make_insert_range_iterator(
|
||||
sprout::internal_begin(cont), sprout::end(cont),
|
||||
first, first, last
|
||||
),
|
||||
sprout::make_insert_range_iterator(
|
||||
sprout::internal_end(cont), sprout::end(cont),
|
||||
last, first, last
|
||||
)
|
||||
);
|
||||
}
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
deep_copy(Cont&& cont) {
|
||||
return sprout::deep_copy(sprout::get_internal(sprout::forward<Cont>(cont)));
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
make(Args&&... args) {
|
||||
return sprout::make<copied_type>(sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake(Cont&& cont, typename sprout::container_traits<Container>::difference_type size, Args&&... args) {
|
||||
return remake_impl(sprout::get_internal(sprout::forward<Cont>(cont)), size, sprout::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// container_fitness_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct container_fitness_traits<sprout::back_insert_iterator<Container> > {
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR typename sprout::container_traits<Container>::difference_type
|
||||
fit_size(Cont&& cont, typename sprout::container_traits<Container>::difference_type size) {
|
||||
return size + sprout::size(sprout::forward<Cont>(cont));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// sub_container_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct sub_container_traits<sprout::back_insert_iterator<Container> >
|
||||
: public sprout::sub_container_traits<sprout::container_holder<Container> >
|
||||
{};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_BACK_INSERT_ITERATOR_HPP
|
|
@ -11,7 +11,6 @@
|
|||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/numeric/dft/dft_element.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
|
166
sprout/iterator/front_insert_iterator.hpp
Normal file
166
sprout/iterator/front_insert_iterator.hpp
Normal file
|
@ -0,0 +1,166 @@
|
|||
#ifndef SPROUT_ITERATOR_FRONT_INSERT_ITERATOR_HPP
|
||||
#define SPROUT_ITERATOR_FRONT_INSERT_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/iterator/insert_range_iterator.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/container/container_holder.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/move.hpp>
|
||||
#include <sprout/utility/limited.hpp>
|
||||
#include <sprout/type_traits/arithmetic_promote.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// front_insert_iterator
|
||||
//
|
||||
template<typename Container>
|
||||
class front_insert_iterator
|
||||
: public std::iterator<std::output_iterator_tag, void, void, void, void>
|
||||
, public sprout::container_holder<Container>
|
||||
{
|
||||
private:
|
||||
typedef sprout::container_holder<Container> base_type;
|
||||
public:
|
||||
typedef typename base_type::container_type container_type;
|
||||
typedef typename base_type::internal_type internal_type;
|
||||
typedef typename base_type::iterator iterator;
|
||||
typedef typename base_type::const_iterator const_iterator;
|
||||
typedef typename base_type::reference reference;
|
||||
typedef typename base_type::const_reference const_reference;
|
||||
typedef typename base_type::size_type size_type;
|
||||
typedef typename base_type::difference_type difference_type;
|
||||
typedef typename base_type::pointer pointer;
|
||||
typedef typename base_type::const_pointer const_pointer;
|
||||
typedef typename base_type::param_type param_type;
|
||||
typedef typename base_type::const_param_type const_param_type;
|
||||
typedef typename base_type::holder_type holder_type;
|
||||
protected:
|
||||
using base_type::container;
|
||||
public:
|
||||
SPROUT_CONSTEXPR front_insert_iterator() = default;
|
||||
explicit SPROUT_CONSTEXPR front_insert_iterator(param_type x)
|
||||
: base_type(x)
|
||||
{}
|
||||
SPROUT_CONSTEXPR front_insert_iterator(front_insert_iterator const&) = default;
|
||||
front_insert_iterator& operator=(typename container_type::value_type const& value) {
|
||||
container->push_front(value);
|
||||
return *this;
|
||||
}
|
||||
front_insert_iterator& operator=(typename container_type::value_type&& value) {
|
||||
container->push_front(sprout::move(value));
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CONSTEXPR front_insert_iterator const& operator*() const {
|
||||
return *this;
|
||||
}
|
||||
front_insert_iterator& operator*() {
|
||||
return *this;
|
||||
}
|
||||
front_insert_iterator& operator++() {
|
||||
return *this;
|
||||
}
|
||||
front_insert_iterator operator++(int) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(front_insert_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(base_type::swap(other)))
|
||||
{
|
||||
base_type::swap(other);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// swap
|
||||
//
|
||||
template<typename Container>
|
||||
inline void
|
||||
swap(sprout::front_insert_iterator<Container>& lhs, sprout::front_insert_iterator<Container>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
//
|
||||
// front_inserter
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::front_insert_iterator<Container>
|
||||
front_inserter(Container& x) {
|
||||
return sprout::front_insert_iterator<Container>(x);
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::front_insert_iterator<Container const>
|
||||
front_inserter(Container const& x) {
|
||||
return sprout::front_insert_iterator<Container const>(x);
|
||||
}
|
||||
|
||||
//
|
||||
// container_construct_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct container_construct_traits<sprout::front_insert_iterator<Container> > {
|
||||
public:
|
||||
typedef typename sprout::container_construct_traits<Container>::copied_type copied_type;
|
||||
private:
|
||||
template<typename Cont, typename InputIterator>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake_impl(Cont&& cont, typename sprout::container_traits<Container>::difference_type size, InputIterator first, InputIterator last) {
|
||||
return sprout::make<copied_type>(
|
||||
sprout::make_insert_range_iterator(
|
||||
sprout::internal_begin(cont), sprout::begin(cont),
|
||||
first, first, last
|
||||
),
|
||||
sprout::make_insert_range_iterator(
|
||||
sprout::internal_end(cont), sprout::begin(cont),
|
||||
last, first, last
|
||||
)
|
||||
);
|
||||
}
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
deep_copy(Cont&& cont) {
|
||||
return sprout::deep_copy(sprout::get_internal(sprout::forward<Cont>(cont)));
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
make(Args&&... args) {
|
||||
return sprout::make<copied_type>(sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake(Cont&& cont, typename sprout::container_traits<Container>::difference_type size, Args&&... args) {
|
||||
return remake_impl(sprout::get_internal(sprout::forward<Cont>(cont)), size, sprout::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// container_fitness_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct container_fitness_traits<sprout::front_insert_iterator<Container> > {
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR typename sprout::container_traits<Container>::difference_type
|
||||
fit_size(Cont&& cont, typename sprout::container_traits<Container>::difference_type size) {
|
||||
return size + sprout::size(sprout::forward<Cont>(cont));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// sub_container_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct sub_container_traits<sprout::front_insert_iterator<Container> >
|
||||
: public sprout::sub_container_traits<sprout::container_holder<Container> >
|
||||
{};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_FRONT_INSERT_ITERATOR_HPP
|
|
@ -11,7 +11,6 @@
|
|||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/numeric/dft/idft_element.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
|
322
sprout/iterator/insert_range_iterator.hpp
Normal file
322
sprout/iterator/insert_range_iterator.hpp
Normal file
|
@ -0,0 +1,322 @@
|
|||
#ifndef SPROUT_ITERATOR_INSERT_RANGE_ITERATOR_HPP
|
||||
#define SPROUT_ITERATOR_INSERT_RANGE_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/iterator/type_traits/common.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/utility/limited.hpp>
|
||||
#include <sprout/type_traits/arithmetic_promote.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// insert_range_iterator
|
||||
//
|
||||
template<typename DstIterator, typename SrcIterator>
|
||||
class insert_range_iterator
|
||||
: public std::iterator<
|
||||
typename sprout::common_iterator_category<DstIterator, SrcIterator>::type,
|
||||
typename sprout::common_iterator_value_type<DstIterator, SrcIterator>::type,
|
||||
typename sprout::common_iterator_difference_type<DstIterator, SrcIterator>::type,
|
||||
typename sprout::common_iterator_pointer<DstIterator, SrcIterator>::type,
|
||||
typename sprout::common_iterator_reference<DstIterator, SrcIterator>::type
|
||||
>
|
||||
{
|
||||
public:
|
||||
typedef DstIterator iterator_type;
|
||||
typedef SrcIterator iterator2_type;
|
||||
typedef typename sprout::common_iterator_category<DstIterator, SrcIterator>::type iterator_category;
|
||||
typedef typename sprout::common_iterator_value_type<DstIterator, SrcIterator>::type value_type;
|
||||
typedef typename sprout::common_iterator_difference_type<DstIterator, SrcIterator>::type difference_type;
|
||||
typedef typename sprout::common_iterator_pointer<DstIterator, SrcIterator>::type pointer;
|
||||
typedef typename sprout::common_iterator_reference<DstIterator, SrcIterator>::type reference;
|
||||
protected:
|
||||
iterator_type current1;
|
||||
iterator_type pos1;
|
||||
iterator2_type current2;
|
||||
iterator2_type first2;
|
||||
iterator2_type last2;
|
||||
private:
|
||||
SPROUT_CONSTEXPR insert_range_iterator advance_impl(difference_type n) const {
|
||||
return n >= 0
|
||||
? current1 > pos1 ? insert_range_iterator(sprout::next(current1, n), pos1, current2, first2, last2)
|
||||
: current1 == pos1 ? current2 == last2 ? insert_range_iterator(sprout::next(current1, n), pos1, current2, first2, last2)
|
||||
: n <= sprout::distance(current2, last2) ? insert_range_iterator(current1, pos1, last2, sprout::next(current2, n), first2, last2)
|
||||
: insert_range_iterator(sprout::next(current1, n - sprout::distance(current2, last2)), pos1, last2, first2, last2)
|
||||
: n <= sprout::distance(current1, pos1) ? insert_range_iterator(sprout::next(current1, n), pos1, current2, first2, last2)
|
||||
: n <= sprout::distance(current1, pos1) + sprout::distance(current2, last2)
|
||||
? insert_range_iterator(pos1, pos1, last2, sprout::next(current2, n - sprout::distance(current1, pos1)), first2, last2)
|
||||
: insert_range_iterator(sprout::next(current1, n - sprout::distance(current1, pos1) - sprout::distance(current2, last2)), pos1, last2, first2, last2)
|
||||
: current1 < pos1 ? insert_range_iterator(sprout::next(current1, n), pos1, current2, first2, last2)
|
||||
: current1 == pos1 ? current2 == first2 ? insert_range_iterator(sprout::next(current1, n), pos1, current2, first2, last2)
|
||||
: -n <= sprout::distance(first2, current2) ? insert_range_iterator(current1, pos1, last2, sprout::next(current2, n), first2, last2)
|
||||
: insert_range_iterator(sprout::next(current1, n - sprout::distance(first2, current2)), pos1, first2, first2, last2)
|
||||
: -n <= sprout::distance(pos1, current1) ? insert_range_iterator(sprout::next(current1, n), pos1, current2, first2, last2)
|
||||
: -n <= sprout::distance(pos1, current1) + sprout::distance(first2, current2)
|
||||
? insert_range_iterator(pos1, pos1, last2, sprout::next(current2, n - sprout::distance(pos1, current1)), first2, last2)
|
||||
: insert_range_iterator(sprout::next(current1, n - sprout::distance(pos1, current1) - sprout::distance(first2, current2)), pos1, first2, first2, last2)
|
||||
;
|
||||
}
|
||||
public:
|
||||
insert_range_iterator() = default;
|
||||
insert_range_iterator(insert_range_iterator const&) = default;
|
||||
SPROUT_CONSTEXPR insert_range_iterator(iterator_type it1, iterator_type pos1, iterator2_type it2, iterator2_type first2, iterator2_type last2)
|
||||
: current1(it1), pos1(pos1)
|
||||
, current2(it2), first2(first2), last2(last2)
|
||||
{}
|
||||
template<typename U, typename V>
|
||||
SPROUT_CONSTEXPR insert_range_iterator(insert_range_iterator<U, V> const& it)
|
||||
: current1(it.base()), pos1(it.position())
|
||||
, current2(it.base2()), first2(it.first()), last2(it.last())
|
||||
{}
|
||||
template<typename U, typename V>
|
||||
insert_range_iterator& operator=(insert_range_iterator<U, V> const& it) {
|
||||
insert_range_iterator temp(it);
|
||||
temp.swap(*this);
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator_type base() const {
|
||||
return current1;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator_type position() const {
|
||||
return pos1;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type base2() const {
|
||||
return current2;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type first() const {
|
||||
return first2;
|
||||
}
|
||||
SPROUT_CONSTEXPR iterator2_type last() const {
|
||||
return last2;
|
||||
}
|
||||
SPROUT_CONSTEXPR bool is_in_base() const {
|
||||
return current1 != pos1 || current2 == last2;
|
||||
}
|
||||
SPROUT_CONSTEXPR reference operator*() const {
|
||||
return is_in_base() ? *current1 : *current2;
|
||||
}
|
||||
SPROUT_CONSTEXPR pointer operator->() const {
|
||||
return &*(*this);
|
||||
}
|
||||
insert_range_iterator& operator++() {
|
||||
if (is_in_base()) {
|
||||
++current1;
|
||||
} else {
|
||||
++current2;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
insert_range_iterator operator++(int) {
|
||||
insert_range_iterator result(*this);
|
||||
if (is_in_base()) {
|
||||
++current1;
|
||||
} else {
|
||||
++current2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
insert_range_iterator& operator--() {
|
||||
if (current1 != pos1 || current2 == first2) {
|
||||
--current1;
|
||||
} else {
|
||||
--current2;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
insert_range_iterator operator--(int) {
|
||||
insert_range_iterator temp(*this);
|
||||
if (current1 != pos1 || current2 == first2) {
|
||||
--current1;
|
||||
} else {
|
||||
--current2;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
SPROUT_CONSTEXPR insert_range_iterator operator+(difference_type n) const {
|
||||
return advance_impl(n);
|
||||
}
|
||||
SPROUT_CONSTEXPR insert_range_iterator operator-(difference_type n) const {
|
||||
return advance_impl(-n);
|
||||
}
|
||||
insert_range_iterator& operator+=(difference_type n) {
|
||||
insert_range_iterator temp(*this + n);
|
||||
temp.swap(*this);
|
||||
return *this;
|
||||
}
|
||||
insert_range_iterator& operator-=(difference_type n) {
|
||||
insert_range_iterator temp(*this - n);
|
||||
temp.swap(*this);
|
||||
return *this;
|
||||
}
|
||||
SPROUT_CONSTEXPR reference operator[](difference_type n) const {
|
||||
return *(*this + n);
|
||||
}
|
||||
SPROUT_CONSTEXPR insert_range_iterator next() const {
|
||||
return is_in_base() ? insert_range_iterator(sprout::next(current1), pos1, current2, first2, last2)
|
||||
: insert_range_iterator(current1, pos1, sprout::next(current2), first2, last2)
|
||||
;
|
||||
}
|
||||
SPROUT_CONSTEXPR insert_range_iterator prev() const {
|
||||
return current1 != pos1 || current2 == first2 ? insert_range_iterator(sprout::prev(current1), pos1, current2, first2, last2)
|
||||
: insert_range_iterator(current1, pos1, sprout::prev(current2), first2, last2)
|
||||
;
|
||||
}
|
||||
void swap(insert_range_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current1, other.current1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(pos1, other.pos1))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(current2, other.current2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(first2, other.first2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(last2, other.last2))
|
||||
)
|
||||
{
|
||||
sprout::swap(current1, other.current1);
|
||||
sprout::swap(pos1, other.pos1);
|
||||
sprout::swap(current2, other.current2);
|
||||
sprout::swap(first2, other.first2);
|
||||
sprout::swap(last2, other.last2);
|
||||
}
|
||||
};
|
||||
|
||||
template<
|
||||
typename DstIterator1, typename SrcIterator1,
|
||||
typename DstIterator2, typename SrcIterator2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator==(
|
||||
sprout::insert_range_iterator<DstIterator1, SrcIterator1> const& lhs,
|
||||
sprout::insert_range_iterator<DstIterator2, SrcIterator2> const& rhs
|
||||
)
|
||||
{
|
||||
return lhs.base() == rhs.base() && lhs.base2() == rhs.base2();
|
||||
}
|
||||
template<
|
||||
typename DstIterator1, typename SrcIterator1,
|
||||
typename DstIterator2, typename SrcIterator2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator!=(
|
||||
sprout::insert_range_iterator<DstIterator1, SrcIterator1> const& lhs,
|
||||
sprout::insert_range_iterator<DstIterator2, SrcIterator2> const& rhs
|
||||
)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
template<
|
||||
typename DstIterator1, typename SrcIterator1,
|
||||
typename DstIterator2, typename SrcIterator2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator<(
|
||||
sprout::insert_range_iterator<DstIterator1, SrcIterator1> const& lhs,
|
||||
sprout::insert_range_iterator<DstIterator2, SrcIterator2> const& rhs
|
||||
)
|
||||
{
|
||||
return lhs.is_in_base() && rhs.is_in_base() ? lhs.base() < rhs.base()
|
||||
: !lhs.is_in_base() && !rhs.is_in_base() ? lhs.base2() < rhs.base2()
|
||||
: lhs.is_in_base()
|
||||
;
|
||||
}
|
||||
template<
|
||||
typename DstIterator1, typename SrcIterator1,
|
||||
typename DstIterator2, typename SrcIterator2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator>(
|
||||
sprout::insert_range_iterator<DstIterator1, SrcIterator1> const& lhs,
|
||||
sprout::insert_range_iterator<DstIterator2, SrcIterator2> const& rhs
|
||||
)
|
||||
{
|
||||
return rhs < lhs;
|
||||
}
|
||||
template<
|
||||
typename DstIterator1, typename SrcIterator1,
|
||||
typename DstIterator2, typename SrcIterator2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator<=(
|
||||
sprout::insert_range_iterator<DstIterator1, SrcIterator1> const& lhs,
|
||||
sprout::insert_range_iterator<DstIterator2, SrcIterator2> const& rhs
|
||||
)
|
||||
{
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
template<
|
||||
typename DstIterator1, typename SrcIterator1,
|
||||
typename DstIterator2, typename SrcIterator2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator>=(
|
||||
sprout::insert_range_iterator<DstIterator1, SrcIterator1> const& lhs,
|
||||
sprout::insert_range_iterator<DstIterator2, SrcIterator2> const& rhs
|
||||
)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
template<
|
||||
typename DstIterator1, typename SrcIterator1,
|
||||
typename DstIterator2, typename SrcIterator2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR typename sprout::arithmetic_promote<
|
||||
typename sprout::insert_range_iterator<DstIterator1, SrcIterator1>::difference_type,
|
||||
typename sprout::insert_range_iterator<DstIterator2, SrcIterator2>::difference_type
|
||||
>::type
|
||||
operator-(
|
||||
sprout::insert_range_iterator<DstIterator1, SrcIterator1> const& lhs,
|
||||
sprout::insert_range_iterator<DstIterator2, SrcIterator2> const& rhs
|
||||
)
|
||||
{
|
||||
return sprout::limited::plus(lhs.base() - rhs.base(), lhs.base2() - rhs.base2());
|
||||
}
|
||||
template<typename DstIterator, typename SrcIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::insert_range_iterator<DstIterator, SrcIterator> operator+(
|
||||
typename sprout::insert_range_iterator<DstIterator, SrcIterator>::difference_type n,
|
||||
sprout::insert_range_iterator<DstIterator, SrcIterator> const& it
|
||||
)
|
||||
{
|
||||
return it + n;
|
||||
}
|
||||
|
||||
//
|
||||
// make_insert_range_iterator
|
||||
//
|
||||
template<typename DstIterator, typename SrcIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::insert_range_iterator<DstIterator, SrcIterator>
|
||||
make_insert_range_iterator(DstIterator it1, DstIterator pos1, SrcIterator it2, SrcIterator first2, SrcIterator last2) {
|
||||
return sprout::insert_range_iterator<DstIterator, SrcIterator>(it1, pos1, it2, first2, last2);
|
||||
}
|
||||
|
||||
//
|
||||
// swap
|
||||
//
|
||||
template<typename DstIterator, typename SrcIterator>
|
||||
inline void
|
||||
swap(
|
||||
sprout::insert_range_iterator<DstIterator, SrcIterator>& lhs,
|
||||
sprout::insert_range_iterator<DstIterator, SrcIterator>& rhs
|
||||
)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
//
|
||||
// iterator_next
|
||||
//
|
||||
template<typename DstIterator, typename SrcIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::insert_range_iterator<DstIterator, SrcIterator>
|
||||
iterator_next(sprout::insert_range_iterator<DstIterator, SrcIterator> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
|
||||
//
|
||||
// iterator_prev
|
||||
//
|
||||
template<typename DstIterator, typename SrcIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::insert_range_iterator<DstIterator, SrcIterator>
|
||||
iterator_prev(sprout::insert_range_iterator<DstIterator, SrcIterator> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_INSERT_RANGE_ITERATOR_HPP
|
8
sprout/iterator/inserter.hpp
Normal file
8
sprout/iterator/inserter.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef SPROUT_ITERATOR_INSERTER_HPP
|
||||
#define SPROUT_ITERATOR_INSERTER_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/back_insert_iterator.hpp>
|
||||
#include <sprout/iterator/front_insert_iterator.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_ITERATOR_INSERTER_HPP
|
|
@ -12,7 +12,6 @@
|
|||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/utility/limited.hpp>
|
||||
#include <sprout/type_traits/arithmetic_promote.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -265,8 +264,8 @@ namespace sprout {
|
|||
sprout::joint_iterator<LIterator2, RIterator2> const& rhs
|
||||
)
|
||||
{
|
||||
return lhs.is_in_left() && rhs.is_in_left() ? rhs.base() - lhs.base()
|
||||
: !lhs.is_in_left() && !rhs.is_in_left() ? rhs.base2() - lhs.base2()
|
||||
return lhs.is_in_left() && rhs.is_in_left() ? lhs.base() - rhs.base()
|
||||
: !lhs.is_in_left() && !rhs.is_in_left() ? lhs.base2() - rhs.base2()
|
||||
: lhs.is_in_left() ? sprout::limited::plus(lhs.left_end() - lhs.base(), rhs.base2() - rhs.right_begin())
|
||||
: sprout::limited::plus(lhs.base2() - lhs.right_begin(), rhs.left_end() - rhs.base())
|
||||
;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/iterator/various.hpp>
|
||||
#include <sprout/iterator/adaptor.hpp>
|
||||
#include <sprout/iterator/inserter.hpp>
|
||||
#include <sprout/iterator/wave.hpp>
|
||||
#include <sprout/iterator/dft.hpp>
|
||||
|
||||
|
|
|
@ -71,19 +71,19 @@ namespace sprout {
|
|||
remake_iterator() = default;
|
||||
SPROUT_CONSTEXPR remake_iterator(remake_iterator const& other)
|
||||
: current(other.current), current2(other.current2)
|
||||
, fst(other.fst) , lst(other.lst)
|
||||
, begin_off(other.begin_off) , end_off(other.end_off)
|
||||
, fst(other.fst), lst(other.lst)
|
||||
, begin_off(other.begin_off), end_off(other.end_off)
|
||||
{}
|
||||
SPROUT_CONSTEXPR remake_iterator(iterator_type it, iterator2_type it2, iterator2_type fst, iterator2_type lst, difference_type begin_off, difference_type end_off)
|
||||
: current(it), current2(it2)
|
||||
, fst(fst), lst(lst)
|
||||
, begin_off(begin_off) , end_off(end_off)
|
||||
, begin_off(begin_off), end_off(end_off)
|
||||
{}
|
||||
template<typename U, typename V>
|
||||
SPROUT_CONSTEXPR remake_iterator(remake_iterator<U, V> const& it)
|
||||
: current(it.base()), current2(it.base2())
|
||||
, fst(it.first()), lst(it.last())
|
||||
, begin_off(it.begin_offset()) , end_off(it.end_offset())
|
||||
, begin_off(it.begin_offset()), end_off(it.end_offset())
|
||||
{}
|
||||
template<typename U, typename V>
|
||||
remake_iterator& operator=(remake_iterator<U, V> const& it) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace sprout {
|
|||
1.101191032362797755956e62, \
|
||||
-2.135525954525350118866e64, \
|
||||
4.332889698664119241962e66, \
|
||||
-9.18855282416693282262e68 , \
|
||||
-9.18855282416693282262e68, \
|
||||
2.034689677632907449346e71, \
|
||||
-4.70038339580357310786e73, \
|
||||
1.131804344548424927068e76, \
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -26,7 +25,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::amplitude_spectrum(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -25,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::dft(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
namespace fit {
|
||||
|
@ -25,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::idft(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include <sprout/pit/pit.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -26,7 +25,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::phase_spectrum(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -25,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::adjacent_difference(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <sprout/algorithm/fit/result_of.hpp>
|
||||
#include <sprout/sub_array/sub_array.hpp>
|
||||
#include <sprout/sub_array/sub.hpp>
|
||||
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
||||
#include <sprout/iterator/type_traits/is_iterator.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -25,7 +24,7 @@ namespace sprout {
|
|||
return sprout::sub_copy(
|
||||
sprout::get_internal(sprout::fixed::partial_sum(first, last, result)),
|
||||
offset,
|
||||
offset + NS_SSCRISK_CEL_OR_SPROUT::min(sprout::distance(first, last), sprout::size(result))
|
||||
offset + sprout::fit_size(result, sprout::distance(first, last))
|
||||
);
|
||||
}
|
||||
} // namespace detail
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace sprout {
|
|||
*this
|
||||
)
|
||||
: sprout::random::random_result<Engine, uniform_smallint>(
|
||||
sprout::random::detail::add<RangeType, result_type>()(offset , min_),
|
||||
sprout::random::detail::add<RangeType, result_type>()(offset, min_),
|
||||
rnd.engine(),
|
||||
*this
|
||||
)
|
||||
|
|
|
@ -35,17 +35,17 @@ namespace sprout {
|
|||
IntType den_;
|
||||
protected:
|
||||
SPROUT_CONSTEXPR rational_impl()
|
||||
: num_(0) , den_(1)
|
||||
: num_(0), den_(1)
|
||||
{}
|
||||
rational_impl(rational_impl const&) = default;
|
||||
SPROUT_CONSTEXPR rational_impl(param_type n)
|
||||
: num_(n) , den_(1)
|
||||
: num_(n), den_(1)
|
||||
{}
|
||||
SPROUT_CONSTEXPR rational_impl(param_type n, param_type d)
|
||||
: num_(n) , den_(d)
|
||||
: num_(n), den_(d)
|
||||
{}
|
||||
SPROUT_CONSTEXPR rational_impl(param_type n, param_type d, param_type g)
|
||||
: num_(n / g) , den_(d / g)
|
||||
: num_(n / g), den_(d / g)
|
||||
{}
|
||||
};
|
||||
} // namespace detail
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace sprout {
|
|||
last
|
||||
)
|
||||
{}
|
||||
SPROUT_CONSTEXPR sub_array(sub_array<Container> const& other, const_iterator first, const_iterator last)
|
||||
SPROUT_CONSTEXPR sub_array(sub_array const& other, const_iterator first, const_iterator last)
|
||||
: impl_type(
|
||||
array_tag(),
|
||||
impl_type::template to_param<Container>(other.array_),
|
||||
|
@ -226,7 +226,7 @@ namespace sprout {
|
|||
sprout::distance(sprout::begin(other.get_array()), last)
|
||||
)
|
||||
{}
|
||||
SPROUT_CONSTEXPR sub_array(sub_array<Container> const& other, difference_type first, difference_type last)
|
||||
SPROUT_CONSTEXPR sub_array(sub_array const& other, difference_type first, difference_type last)
|
||||
: impl_type(
|
||||
array_tag(),
|
||||
impl_type::template to_param<Container>(other.array_),
|
||||
|
@ -316,14 +316,14 @@ namespace sprout {
|
|||
}
|
||||
// others:
|
||||
template<typename Container2>
|
||||
sub_array<Container>& operator=(sub_array<Container2> const& rhs) {
|
||||
sub_array& operator=(sub_array<Container2> const& rhs) {
|
||||
array_ = rhs.array_;
|
||||
first_ = rhs.first_;
|
||||
last_ = rhs.last_;
|
||||
return *this;
|
||||
}
|
||||
template<typename Container2>
|
||||
sub_array<Container>& operator=(sub_array<Container2>&& rhs) {
|
||||
sub_array& operator=(sub_array<Container2>&& rhs) {
|
||||
array_ = std::move(rhs.array_);
|
||||
first_ = std::move(rhs.first_);
|
||||
last_ = std::move(rhs.last_);
|
||||
|
|
Loading…
Add table
Reference in a new issue