diff --git a/sprout/algorithm/fixed/copy.hpp b/sprout/algorithm/fixed/copy.hpp index c89dceef..d524b16a 100644 --- a/sprout/algorithm/fixed/copy.hpp +++ b/sprout/algorithm/fixed/copy.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -27,8 +28,8 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? *(first + Indexes - offset) - : *(sprout::fixed_begin(result) + Indexes) + ? *sprout::next(first, Indexes - offset) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/copy_backward.hpp b/sprout/algorithm/fixed/copy_backward.hpp index 5242e7be..057e72e7 100644 --- a/sprout/algorithm/fixed/copy_backward.hpp +++ b/sprout/algorithm/fixed/copy_backward.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -27,8 +28,8 @@ namespace sprout { result, sprout::size(result), (Indexes < offset && Indexes + size >= offset && Indexes + input_size >= offset - ? *(last + Indexes - offset) - : *(sprout::fixed_begin(result) + Indexes) + ? *sprout::next(last, Indexes - offset) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/copy_if.hpp b/sprout/algorithm/fixed/copy_if.hpp index 7884f751..e8c44bb3 100644 --- a/sprout/algorithm/fixed/copy_if.hpp +++ b/sprout/algorithm/fixed/copy_if.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace sprout { @@ -30,7 +31,7 @@ namespace sprout { Args const&... args ) { - return copy_if_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return copy_if_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -62,8 +63,8 @@ namespace sprout { { return first != last && sizeof...(Args) < offset ? pred(*first) - ? copy_if_impl_2(first + 1, last, result, pred, offset, args..., *first) - : copy_if_impl_2(first + 1, last, result, pred, offset, args...) + ? copy_if_impl_2(sprout::next(first), last, result, pred, offset, args..., *first) + : copy_if_impl_2(sprout::next(first), last, result, pred, offset, args...) : copy_if_impl_3(result, args...) ; } @@ -96,7 +97,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? copy_if_impl_1(first, last, result, pred, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? copy_if_impl_1(first, last, result, pred, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : copy_if_impl_2(first, last, result, pred, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/copy_n.hpp b/sprout/algorithm/fixed/copy_n.hpp index 43d3b2bc..d554faf8 100644 --- a/sprout/algorithm/fixed/copy_n.hpp +++ b/sprout/algorithm/fixed/copy_n.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -21,7 +22,7 @@ namespace sprout { { return sprout::fixed::detail::copy_impl( first, - first + n, + sprout::next(first, n), result, typename sprout::index_range<0, sprout::fixed_container_traits::fixed_size>::type(), sprout::fixed_begin_offset(result), diff --git a/sprout/algorithm/fixed/fill.hpp b/sprout/algorithm/fixed/fill.hpp index 24affc14..6c941ea8 100644 --- a/sprout/algorithm/fixed/fill.hpp +++ b/sprout/algorithm/fixed/fill.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include namespace sprout { @@ -25,7 +26,7 @@ namespace sprout { sprout::size(cont), (Indexes >= offset && Indexes < offset + size ? value - : *(sprout::fixed_begin(cont) + Indexes) + : *sprout::next(sprout::fixed_begin(cont), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/generate.hpp b/sprout/algorithm/fixed/generate.hpp index a1bda5f5..d31d0651 100644 --- a/sprout/algorithm/fixed/generate.hpp +++ b/sprout/algorithm/fixed/generate.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include namespace sprout { @@ -55,7 +56,7 @@ namespace sprout { Args const&... args ) { - return generate_impl_4(cont, args..., *(sprout::fixed_begin(cont) + sizeof...(Args))); + return generate_impl_4(cont, args..., *sprout::next(sprout::fixed_begin(cont), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -161,7 +162,7 @@ namespace sprout { ) { return sizeof...(Args) - InitSize < offset - ? generate_impl_1(cont, gen, offset, size, args..., *(sprout::fixed_begin(cont) + sizeof...(Args) - InitSize)) + ? generate_impl_1(cont, gen, offset, size, args..., *sprout::next(sprout::fixed_begin(cont), sizeof...(Args) - InitSize)) : generate_impl_2(cont, gen, offset, size, InitSize, args...) ; } diff --git a/sprout/algorithm/fixed/make_heap.hpp b/sprout/algorithm/fixed/make_heap.hpp index 910869e9..c373b3a3 100644 --- a/sprout/algorithm/fixed/make_heap.hpp +++ b/sprout/algorithm/fixed/make_heap.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -32,10 +33,14 @@ namespace sprout { typename sprout::fixed_container_traits::difference_type r ) { - return comp(*(sprout::fixed_begin(cont) + offset + l), *(sprout::fixed_begin(cont) + offset + r)) - ? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + r)) + return comp(*sprout::next(sprout::fixed_begin(cont), offset + l), *sprout::next(sprout::fixed_begin(cont), offset + r)) + ? comp(*sprout::next(sprout::fixed_begin(cont), offset + n), *sprout::next(sprout::fixed_begin(cont), offset + r)) ? sprout::fixed::detail::make_heap_impl( - sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + r), + sprout::fixed::swap_element( + cont, + sprout::next(sprout::fixed_begin(cont), offset + n), + sprout::next(sprout::fixed_begin(cont), offset + r) + ), comp, offset, size, @@ -44,9 +49,13 @@ namespace sprout { r * 2 + 2 ) : sprout::clone(cont) - : comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + l)) + : comp(*sprout::next(sprout::fixed_begin(cont), offset + n), *sprout::next(sprout::fixed_begin(cont), offset + l)) ? sprout::fixed::detail::make_heap_impl( - sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + l), + sprout::fixed::swap_element( + cont, + sprout::next(sprout::fixed_begin(cont), offset + n), + sprout::next(sprout::fixed_begin(cont), offset + l) + ), comp, offset, size, @@ -71,11 +80,23 @@ namespace sprout { return r > size ? sprout::clone(cont) : r == size - ? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + l)) - ? sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + l) + ? comp(*sprout::next(sprout::fixed_begin(cont), offset + n), *sprout::next(sprout::fixed_begin(cont), offset + l)) + ? sprout::fixed::swap_element( + cont, + sprout::next(sprout::fixed_begin(cont), offset + n), + sprout::next(sprout::fixed_begin(cont), offset + l) + ) : sprout::clone(cont) : sprout::fixed::detail::make_heap_impl_1( - sprout::fixed::detail::make_heap_impl(sprout::fixed::detail::make_heap_impl(cont, comp, offset, size, l, l * 2 + 1, l * 2 + 2), comp, offset, size, r, r * 2 + 1, r * 2 + 2), + sprout::fixed::detail::make_heap_impl( + sprout::fixed::detail::make_heap_impl(cont, comp, offset, size, l, l * 2 + 1, l * 2 + 2), + comp, + offset, + size, + r, + r * 2 + 1, + r * 2 + 2 + ), comp, offset, size, diff --git a/sprout/algorithm/fixed/make_partial_heap.hpp b/sprout/algorithm/fixed/make_partial_heap.hpp index d0e6aec9..51815628 100644 --- a/sprout/algorithm/fixed/make_partial_heap.hpp +++ b/sprout/algorithm/fixed/make_partial_heap.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -25,10 +26,14 @@ namespace sprout { ) { return n < size - ? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset)) + ? comp(*sprout::next(sprout::fixed_begin(cont), offset + n), *sprout::next(sprout::fixed_begin(cont), offset)) ? sprout::fixed::detail::make_partial_heap_impl_1( sprout::fixed::detail::pop_heap_impl( - sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset), + sprout::fixed::swap_element( + cont, + sprout::next(sprout::fixed_begin(cont), offset + n), + sprout::next(sprout::fixed_begin(cont), offset) + ), comp, offset, middle_size diff --git a/sprout/algorithm/fixed/merge.hpp b/sprout/algorithm/fixed/merge.hpp index d3720c8e..b76a4165 100644 --- a/sprout/algorithm/fixed/merge.hpp +++ b/sprout/algorithm/fixed/merge.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -31,7 +32,7 @@ namespace sprout { Args const&... args ) { - return merge_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return merge_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -69,11 +70,11 @@ namespace sprout { ? first1 != last1 ? first2 != last2 ? comp(*first2, *first1) - ? merge_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2) - : merge_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1) - : merge_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1) + ? merge_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args..., *first2) + : merge_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args..., *first1) + : merge_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args..., *first1) : first2 != last2 - ? merge_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2) + ? merge_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args..., *first2) : merge_impl_3(result, args...) : merge_impl_3(result, args...) ; @@ -111,7 +112,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? merge_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? merge_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : merge_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/nth_element.hpp b/sprout/algorithm/fixed/nth_element.hpp index ba2c2a01..eb74512c 100644 --- a/sprout/algorithm/fixed/nth_element.hpp +++ b/sprout/algorithm/fixed/nth_element.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -22,8 +23,8 @@ namespace sprout { { return sprout::fixed::swap_element( cont, - sprout::fixed_begin(cont) + offset, - sprout::fixed_begin(cont) + offset + nth_size + sprout::next(sprout::fixed_begin(cont), offset), + sprout::next(sprout::fixed_begin(cont), offset + nth_size) ); } template diff --git a/sprout/algorithm/fixed/partition_copy.hpp b/sprout/algorithm/fixed/partition_copy.hpp index 52bf59b6..d978c907 100644 --- a/sprout/algorithm/fixed/partition_copy.hpp +++ b/sprout/algorithm/fixed/partition_copy.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace sprout { @@ -30,7 +31,7 @@ namespace sprout { Args const&... args ) { - return partition_copy_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return partition_copy_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -62,8 +63,8 @@ namespace sprout { { return first != last && sizeof...(Args) < offset ? pred(*first) - ? partition_copy_impl_2(first + 1, last, result, pred, offset, *first, args...) - : partition_copy_impl_2(first + 1, last, result, pred, offset, args..., *first) + ? partition_copy_impl_2(sprout::next(first), last, result, pred, offset, *first, args...) + : partition_copy_impl_2(sprout::next(first), last, result, pred, offset, args..., *first) : partition_copy_impl_3(result, args...) ; } @@ -96,7 +97,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? partition_copy_impl_1(first, last, result, pred, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? partition_copy_impl_1(first, last, result, pred, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : partition_copy_impl_2(first, last, result, pred, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/pop_heap.hpp b/sprout/algorithm/fixed/pop_heap.hpp index 4ab2a6bb..cb6ba2c4 100644 --- a/sprout/algorithm/fixed/pop_heap.hpp +++ b/sprout/algorithm/fixed/pop_heap.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -22,10 +23,14 @@ namespace sprout { typename sprout::fixed_container_traits::difference_type r = 2 ) { - return r < size && comp(*(sprout::fixed_begin(cont) + offset + l), *(sprout::fixed_begin(cont) + offset + r)) - ? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + r)) + return r < size && comp(*sprout::next(sprout::fixed_begin(cont), offset + l), *sprout::next(sprout::fixed_begin(cont), offset + r)) + ? comp(*sprout::next(sprout::fixed_begin(cont), offset + n), *sprout::next(sprout::fixed_begin(cont), offset + r)) ? sprout::fixed::detail::pop_heap_impl( - sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + r), + sprout::fixed::swap_element( + cont, + sprout::next(sprout::fixed_begin(cont), offset + n), + sprout::next(sprout::fixed_begin(cont), offset + r) + ), comp, offset, size, @@ -35,9 +40,13 @@ namespace sprout { ) : sprout::clone(cont) : l < size - ? comp(*(sprout::fixed_begin(cont) + offset + n), *(sprout::fixed_begin(cont) + offset + l)) + ? comp(*sprout::next(sprout::fixed_begin(cont), offset + n), *sprout::next(sprout::fixed_begin(cont), offset + l)) ? sprout::fixed::detail::pop_heap_impl( - sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + n, sprout::fixed_begin(cont) + offset + l), + sprout::fixed::swap_element( + cont, + sprout::next(sprout::fixed_begin(cont), offset + n), + sprout::next(sprout::fixed_begin(cont), offset + l) + ), comp, offset, size, diff --git a/sprout/algorithm/fixed/push_heap.hpp b/sprout/algorithm/fixed/push_heap.hpp index 15ab1bfb..8a84ec2a 100644 --- a/sprout/algorithm/fixed/push_heap.hpp +++ b/sprout/algorithm/fixed/push_heap.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -19,9 +20,13 @@ namespace sprout { typename sprout::fixed_container_traits::difference_type n ) { - return n != 0 && comp(*(sprout::fixed_begin(cont) + offset + (n - 1) / 2), *(sprout::fixed_begin(cont) + offset + n)) + return n != 0 && comp(*sprout::next(sprout::fixed_begin(cont), offset + (n - 1) / 2), *sprout::next(sprout::fixed_begin(cont), offset + n)) ? sprout::fixed::detail::push_heap_impl( - sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + offset + (n - 1) / 2, sprout::fixed_begin(cont) + offset + n), + sprout::fixed::swap_element( + cont, + sprout::next(sprout::fixed_begin(cont), offset + (n - 1) / 2), + sprout::next(sprout::fixed_begin(cont), offset + n) + ), comp, offset, (n - 1) / 2 diff --git a/sprout/algorithm/fixed/remove_copy.hpp b/sprout/algorithm/fixed/remove_copy.hpp index d7f6f410..3d5ac7e6 100644 --- a/sprout/algorithm/fixed/remove_copy.hpp +++ b/sprout/algorithm/fixed/remove_copy.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace sprout { @@ -30,7 +31,7 @@ namespace sprout { Args const&... args ) { - return remove_copy_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return remove_copy_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -62,8 +63,8 @@ namespace sprout { { return first != last && sizeof...(Args) < offset ? *first == value - ? remove_copy_impl_2(first + 1, last, result, value, offset, args...) - : remove_copy_impl_2(first + 1, last, result, value, offset, args..., *first) + ? remove_copy_impl_2(sprout::next(first), last, result, value, offset, args...) + : remove_copy_impl_2(sprout::next(first), last, result, value, offset, args..., *first) : remove_copy_impl_3(result, args...) ; } @@ -96,7 +97,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? remove_copy_impl_1(first, last, result, value, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? remove_copy_impl_1(first, last, result, value, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : remove_copy_impl_2(first, last, result, value, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/remove_copy_if.hpp b/sprout/algorithm/fixed/remove_copy_if.hpp index 2856ca50..a86541b4 100644 --- a/sprout/algorithm/fixed/remove_copy_if.hpp +++ b/sprout/algorithm/fixed/remove_copy_if.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace sprout { @@ -30,7 +31,7 @@ namespace sprout { Args const&... args ) { - return remove_copy_if_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return remove_copy_if_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -62,8 +63,8 @@ namespace sprout { { return first != last && sizeof...(Args) < offset ? pred(*first) - ? remove_copy_if_impl_2(first + 1, last, result, pred, offset, args...) - : remove_copy_if_impl_2(first + 1, last, result, pred, offset, args..., *first) + ? remove_copy_if_impl_2(sprout::next(first), last, result, pred, offset, args...) + : remove_copy_if_impl_2(sprout::next(first), last, result, pred, offset, args..., *first) : remove_copy_if_impl_3(result, args...) ; } @@ -96,7 +97,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? remove_copy_if_impl_1(first, last, result, pred, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? remove_copy_if_impl_1(first, last, result, pred, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : remove_copy_if_impl_2(first, last, result, pred, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/replace_copy.hpp b/sprout/algorithm/fixed/replace_copy.hpp index c28f6e7c..56e513fe 100644 --- a/sprout/algorithm/fixed/replace_copy.hpp +++ b/sprout/algorithm/fixed/replace_copy.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -29,8 +30,8 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? *(first + Indexes - offset) == old_value ? new_value : *(first + Indexes - offset) - : *(sprout::fixed_begin(result) + Indexes) + ? *sprout::next(first, Indexes - offset) == old_value ? new_value : *sprout::next(first, Indexes - offset) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/replace_copy_if.hpp b/sprout/algorithm/fixed/replace_copy_if.hpp index 4506ef88..6d417d1a 100644 --- a/sprout/algorithm/fixed/replace_copy_if.hpp +++ b/sprout/algorithm/fixed/replace_copy_if.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -29,8 +30,8 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? pred(*(first + Indexes - offset)) ? new_value : *(first + Indexes - offset) - : *(sprout::fixed_begin(result) + Indexes) + ? pred(*sprout::next(first, Indexes - offset)) ? new_value : *sprout::next(first, Indexes - offset) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/reverse_copy.hpp b/sprout/algorithm/fixed/reverse_copy.hpp index 44cc5db5..2298dede 100644 --- a/sprout/algorithm/fixed/reverse_copy.hpp +++ b/sprout/algorithm/fixed/reverse_copy.hpp @@ -6,7 +6,9 @@ #include #include #include +#include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -28,8 +30,8 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? *(last - 1 - Indexes + offset) - : *(sprout::fixed_begin(result) + Indexes) + ? *sprout::prev(last, 1 + Indexes - offset) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/rotate_copy.hpp b/sprout/algorithm/fixed/rotate_copy.hpp index ff827d63..b6aecb37 100644 --- a/sprout/algorithm/fixed/rotate_copy.hpp +++ b/sprout/algorithm/fixed/rotate_copy.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -29,10 +30,10 @@ namespace sprout { sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size ? (Indexes < offset + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(middle, last) - ? *(middle + Indexes - offset) - : *((first + Indexes - offset) - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, middle)) + ? *sprout::next(middle, Indexes - offset) + : *sprout::prev(sprout::next(first, Indexes - offset), NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(first, middle)) ) - : *(sprout::fixed_begin(result) + Indexes) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/set_difference.hpp b/sprout/algorithm/fixed/set_difference.hpp index 680c3130..d18d9147 100644 --- a/sprout/algorithm/fixed/set_difference.hpp +++ b/sprout/algorithm/fixed/set_difference.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -31,7 +32,7 @@ namespace sprout { Args const&... args ) { - return set_difference_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return set_difference_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -69,13 +70,13 @@ namespace sprout { ? first1 != last1 ? first2 != last2 ? comp(*first1, *first2) - ? set_difference_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1) + ? set_difference_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args..., *first1) : comp(*first2, *first1) - ? set_difference_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...) - : set_difference_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args...) - : set_difference_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1) + ? set_difference_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args...) + : set_difference_impl_2(sprout::next(first1), last1, sprout::next(first2), last2, result, comp, offset, args...) + : set_difference_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args..., *first1) : first2 != last2 - ? set_difference_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...) + ? set_difference_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args...) : set_difference_impl_3(result, args...) : set_difference_impl_3(result, args...) ; @@ -113,7 +114,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? set_difference_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? set_difference_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : set_difference_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/set_intersection.hpp b/sprout/algorithm/fixed/set_intersection.hpp index d7a4905b..c119e409 100644 --- a/sprout/algorithm/fixed/set_intersection.hpp +++ b/sprout/algorithm/fixed/set_intersection.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -31,7 +32,7 @@ namespace sprout { Args const&... args ) { - return set_intersection_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return set_intersection_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -69,13 +70,13 @@ namespace sprout { ? first1 != last1 ? first2 != last2 ? comp(*first1, *first2) - ? set_intersection_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args...) + ? set_intersection_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args...) : comp(*first2, *first1) - ? set_intersection_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...) - : set_intersection_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args..., *first1) - : set_intersection_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args...) + ? set_intersection_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args...) + : set_intersection_impl_2(sprout::next(first1), last1, sprout::next(first2), last2, result, comp, offset, args..., *first1) + : set_intersection_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args...) : first2 != last2 - ? set_intersection_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args...) + ? set_intersection_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args...) : set_intersection_impl_3(result, args...) : set_intersection_impl_3(result, args...) ; @@ -113,7 +114,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? set_intersection_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? set_intersection_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : set_intersection_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/set_symmetric_difference.hpp b/sprout/algorithm/fixed/set_symmetric_difference.hpp index 226684df..aac67901 100644 --- a/sprout/algorithm/fixed/set_symmetric_difference.hpp +++ b/sprout/algorithm/fixed/set_symmetric_difference.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -31,7 +32,7 @@ namespace sprout { Args const&... args ) { - return set_symmetric_difference_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return set_symmetric_difference_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -69,13 +70,13 @@ namespace sprout { ? first1 != last1 ? first2 != last2 ? comp(*first1, *first2) - ? set_symmetric_difference_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1) + ? set_symmetric_difference_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args..., *first1) : comp(*first2, *first1) - ? set_symmetric_difference_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2) - : set_symmetric_difference_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args...) - : set_symmetric_difference_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1) + ? set_symmetric_difference_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args..., *first2) + : set_symmetric_difference_impl_2(sprout::next(first1), last1, sprout::next(first2), last2, result, comp, offset, args...) + : set_symmetric_difference_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args..., *first1) : first2 != last2 - ? set_symmetric_difference_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2) + ? set_symmetric_difference_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args..., *first2) : set_symmetric_difference_impl_3(result, args...) : set_symmetric_difference_impl_3(result, args...) ; @@ -113,7 +114,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? set_symmetric_difference_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? set_symmetric_difference_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : set_symmetric_difference_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/set_union.hpp b/sprout/algorithm/fixed/set_union.hpp index 63cf17c6..303755d3 100644 --- a/sprout/algorithm/fixed/set_union.hpp +++ b/sprout/algorithm/fixed/set_union.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -31,7 +32,7 @@ namespace sprout { Args const&... args ) { - return set_union_impl_3(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return set_union_impl_3(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -69,13 +70,13 @@ namespace sprout { ? first1 != last1 ? first2 != last2 ? comp(*first1, *first2) - ? set_union_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1) + ? set_union_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args..., *first1) : comp(*first2, *first1) - ? set_union_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2) - : set_union_impl_2(first1 + 1, last1, first2 + 1, last2, result, comp, offset, args..., *first1) - : set_union_impl_2(first1 + 1, last1, first2, last2, result, comp, offset, args..., *first1) + ? set_union_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args..., *first2) + : set_union_impl_2(sprout::next(first1), last1, sprout::next(first2), last2, result, comp, offset, args..., *first1) + : set_union_impl_2(sprout::next(first1), last1, first2, last2, result, comp, offset, args..., *first1) : first2 != last2 - ? set_union_impl_2(first1, last1, first2 + 1, last2, result, comp, offset, args..., *first2) + ? set_union_impl_2(first1, last1, sprout::next(first2), last2, result, comp, offset, args..., *first2) : set_union_impl_3(result, args...) : set_union_impl_3(result, args...) ; @@ -113,7 +114,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? set_union_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? set_union_impl_1(first1, last1, first2, last2, result, comp, offset, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : set_union_impl_2(first1, last1, first2, last2, result, comp, offset + sprout::size(result), args...) ; } diff --git a/sprout/algorithm/fixed/sort.hpp b/sprout/algorithm/fixed/sort.hpp index 2c98b663..5cd5d4df 100644 --- a/sprout/algorithm/fixed/sort.hpp +++ b/sprout/algorithm/fixed/sort.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -20,7 +21,7 @@ namespace sprout { typename sprout::fixed_container_traits::difference_type end ) { // pivot を選ぶ(中央の要素) - return *(origin + (end + start) / 2); + return *sprout::next(origin, (end + start) / 2); } template SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::difference_type sort_find_l( @@ -30,7 +31,7 @@ namespace sprout { typename sprout::fixed_container_traits::value_type const& p ) { // left を見つける - return comp(*(origin + l), p) ? sort_find_l(origin, comp, l + 1, p) : l; + return comp(*sprout::next(origin, l), p) ? sort_find_l(origin, comp, l + 1, p) : l; } template SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::difference_type sort_find_r( @@ -40,7 +41,7 @@ namespace sprout { typename sprout::fixed_container_traits::value_type const& p ) { // right を見つける - return comp(p, *(origin + r)) ? sort_find_r(origin, comp, r - 1, p) : r; + return comp(p, *sprout::next(origin, r)) ? sort_find_r(origin, comp, r - 1, p) : r; } template SPROUT_CONSTEXPR inline typename sprout::fixed::result_of::algorithm::type swap_lr( @@ -93,7 +94,7 @@ namespace sprout { { // left と right 比較して、左右に分けてソートするか、またはスワップしてこの範囲のソートを続ける return l >= r ? sort_part_lr(cont, start, end, comp, l, r) - : sort_lr(sprout::fixed::swap_element(cont, sprout::fixed_begin(cont) + l, sprout::fixed_begin(cont) + r), start, end, comp, l + 1, r - 1, p) + : sort_lr(sprout::fixed::swap_element(cont, sprout::next(sprout::fixed_begin(cont), l), sprout::next(sprout::fixed_begin(cont), r)), start, end, comp, l + 1, r - 1, p) ; } template diff --git a/sprout/algorithm/fixed/sort_heap.hpp b/sprout/algorithm/fixed/sort_heap.hpp index 1582a890..3cfa7eaa 100644 --- a/sprout/algorithm/fixed/sort_heap.hpp +++ b/sprout/algorithm/fixed/sort_heap.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -24,7 +25,7 @@ namespace sprout { ? sprout::clone(cont) : sprout::fixed::detail::sort_heap_impl( sprout::fixed::detail::pop_heap_impl( - sprout::fixed::swap_element(cont, sprout::begin(cont), sprout::begin(cont) + size - 1), + sprout::fixed::swap_element(cont, sprout::begin(cont), sprout::next(sprout::begin(cont), size - 1)), comp, offset, size - 1 diff --git a/sprout/algorithm/fixed/stable_partition_copy.hpp b/sprout/algorithm/fixed/stable_partition_copy.hpp index eda39884..f985f21e 100644 --- a/sprout/algorithm/fixed/stable_partition_copy.hpp +++ b/sprout/algorithm/fixed/stable_partition_copy.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace sprout { @@ -30,7 +31,7 @@ namespace sprout { Args const&... args ) { - return stable_partition_copy_impl_4(result, args..., *(sprout::fixed_begin(result) + sizeof...(Args))); + return stable_partition_copy_impl_4(result, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))); } template @@ -63,8 +64,8 @@ namespace sprout { { return first != last && sizeof...(Args) < offset ? !pred(*first) - ? stable_partition_copy_impl_3(first + 1, last, result, pred, offset, args..., *first) - : stable_partition_copy_impl_3(first + 1, last, result, pred, offset, args...) + ? stable_partition_copy_impl_3(sprout::next(first), last, result, pred, offset, args..., *first) + : stable_partition_copy_impl_3(sprout::next(first), last, result, pred, offset, args...) : stable_partition_copy_impl_4(result, args...) ; } @@ -101,8 +102,8 @@ namespace sprout { { return first != last && sizeof...(Args) < offset ? pred(*first) - ? stable_partition_copy_impl_2(first + 1, last, result, pred, offset, origin, args..., *first) - : stable_partition_copy_impl_2(first + 1, last, result, pred, offset, origin, args...) + ? stable_partition_copy_impl_2(sprout::next(first), last, result, pred, offset, origin, args..., *first) + : stable_partition_copy_impl_2(sprout::next(first), last, result, pred, offset, origin, args...) : stable_partition_copy_impl_3(origin, last, result, pred, offset, args...) ; } @@ -137,7 +138,7 @@ namespace sprout { ) { return sizeof...(Args) < offset - ? stable_partition_copy_impl_1(first, last, result, pred, offset, origin, args..., *(sprout::fixed_begin(result) + sizeof...(Args))) + ? stable_partition_copy_impl_1(first, last, result, pred, offset, origin, args..., *sprout::next(sprout::fixed_begin(result), sizeof...(Args))) : stable_partition_copy_impl_2(first, last, result, pred, offset + sprout::size(result), origin, args...) ; } diff --git a/sprout/algorithm/fixed/stable_sort.hpp b/sprout/algorithm/fixed/stable_sort.hpp index 8c9243d3..ddc8df39 100644 --- a/sprout/algorithm/fixed/stable_sort.hpp +++ b/sprout/algorithm/fixed/stable_sort.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -31,7 +32,7 @@ namespace sprout { sprout::index_tuple ) { - return sprout::remake_clone(cont, sprout::size(cont), (*(sprout::fixed_begin(cont) + Indexes))...); + return sprout::remake_clone(cont, sprout::size(cont), (*sprout::next(sprout::fixed_begin(cont), Indexes))...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -47,7 +48,7 @@ namespace sprout { sprout::index_tuple ) { - return comp(*(sprout::fixed_begin(cont) + I1), *(sprout::fixed_begin(cont) + I2)) + return comp(*sprout::next(sprout::fixed_begin(cont), I1), *sprout::next(sprout::fixed_begin(cont), I2)) ? stable_sort_impl_finish(cont, sprout::index_tuple()) : stable_sort_impl_finish(cont, sprout::index_tuple()) ; @@ -66,7 +67,7 @@ namespace sprout { sprout::index_tuple ) { - return comp(*(sprout::fixed_begin(cont) + I1), *(sprout::fixed_begin(cont) + I2)) + return comp(*sprout::next(sprout::fixed_begin(cont), I1), *sprout::next(sprout::fixed_begin(cont), I2)) ? stable_sort_impl_finish(cont, sprout::index_tuple()) : stable_sort_impl_4(cont, comp, sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple()) ; @@ -85,7 +86,7 @@ namespace sprout { sprout::index_tuple ) { - return comp(*(sprout::fixed_begin(cont) + I1), *(sprout::fixed_begin(cont) + I2)) + return comp(*sprout::next(sprout::fixed_begin(cont), I1), *sprout::next(sprout::fixed_begin(cont), I2)) ? stable_sort_impl_4(cont, comp, sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple<>(), sprout::index_tuple(), sprout::index_tuple()) : stable_sort_impl_4(cont, comp, sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple<>(), sprout::index_tuple(), sprout::index_tuple()) ; @@ -104,7 +105,7 @@ namespace sprout { sprout::index_tuple ) { - return comp(*(sprout::fixed_begin(cont) + I1), *(sprout::fixed_begin(cont) + I2)) + return comp(*sprout::next(sprout::fixed_begin(cont), I1), *sprout::next(sprout::fixed_begin(cont), I2)) ? stable_sort_impl_4(cont, comp, sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple<>(), sprout::index_tuple(), sprout::index_tuple()) : stable_sort_impl_4(cont, comp, sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple(), sprout::index_tuple()) ; diff --git a/sprout/algorithm/fixed/swap_element_copy.hpp b/sprout/algorithm/fixed/swap_element_copy.hpp index 26512088..d23853b0 100644 --- a/sprout/algorithm/fixed/swap_element_copy.hpp +++ b/sprout/algorithm/fixed/swap_element_copy.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -29,12 +30,12 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? first + Indexes - offset == pos1 + ? sprout::next(first, Indexes - offset) == pos1 ? *pos2 - : first + Indexes - offset == pos2 + : sprout::next(first, Indexes - offset) == pos2 ? *pos1 - : *(first + Indexes - offset) - : *(sprout::fixed_begin(result) + Indexes) + : *sprout::next(first, Indexes - offset) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/transform.hpp b/sprout/algorithm/fixed/transform.hpp index 37526106..9d8e2b8b 100644 --- a/sprout/algorithm/fixed/transform.hpp +++ b/sprout/algorithm/fixed/transform.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -28,8 +29,8 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? op(*(first + Indexes - offset)) - : *(sprout::fixed_begin(result) + Indexes) + ? op(*sprout::next(first, Indexes - offset)) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } @@ -75,8 +76,8 @@ namespace sprout { result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size - ? op(*(first1 + Indexes - offset), *(first2 + Indexes - offset)) - : *(sprout::fixed_begin(result) + Indexes) + ? op(*sprout::next(first1, Indexes - offset), *sprout::next(first2, Indexes - offset)) + : *sprout::next(sprout::fixed_begin(result), Indexes) )... ); } diff --git a/sprout/algorithm/fixed/unique_copy.hpp b/sprout/algorithm/fixed/unique_copy.hpp index b819187d..44427e4a 100644 --- a/sprout/algorithm/fixed/unique_copy.hpp +++ b/sprout/algorithm/fixed/unique_copy.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace sprout { diff --git a/sprout/array.hpp b/sprout/array.hpp index 5bfd1b1d..345240ab 100644 --- a/sprout/array.hpp +++ b/sprout/array.hpp @@ -275,17 +275,17 @@ namespace std { // template T& get(sprout::array& arr) SPROUT_NOEXCEPT { - static_assert(I < N, "tuple_element<>: index out of range"); + static_assert(I < N, "get: index out of range"); return arr[I]; } template SPROUT_CONSTEXPR T const& get(sprout::array const& arr) SPROUT_NOEXCEPT { - static_assert(I < N, "tuple_element<>: index out of range"); + static_assert(I < N, "get: index out of range"); return arr[I]; } template T&& get(sprout::array&& arr) SPROUT_NOEXCEPT { - return std::move(get(arr)); + return std::move(std::get(arr)); } } // namespace std diff --git a/sprout/detail/algorithm.hpp b/sprout/detail/algorithm.hpp index e7b36f32..ce5f7814 100644 --- a/sprout/detail/algorithm.hpp +++ b/sprout/detail/algorithm.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace sprout { namespace detail { @@ -42,7 +43,7 @@ namespace sprout { { return first == last ? 0 - : (*first == value ? 1 : 0) + sprout::detail::count(first + 1, last, value) + : (*first == value ? 1 : 0) + sprout::detail::count(sprout::next(first), last, value) ; } @@ -58,7 +59,7 @@ namespace sprout { { return first == last ? 0 - : (pred(*first) ? 1 : 0) + sprout::detail::count_if(first + 1, last, pred); + : (pred(*first) ? 1 : 0) + sprout::detail::count_if(sprout::next(first), last, pred); } // @@ -73,7 +74,7 @@ namespace sprout { { return first1 == last1 ? true - : *first1 == *first2 && sprout::detail::equal(first1 + 1, last1, first2 + 1) + : *first1 == *first2 && sprout::detail::equal(sprout::next(first1), last1, sprout::next(first2)) ; } template @@ -86,7 +87,7 @@ namespace sprout { { return first1 == last1 ? true - : pred(*first1, *first2) && sprout::detail::equal(first1 + 1, last1, first2 + 1, pred); + : pred(*first1, *first2) && sprout::detail::equal(sprout::next(first1), last1, sprout::next(first2), pred); } // @@ -106,7 +107,7 @@ namespace sprout { ? true : *first2 < *first1 ? false - : sprout::detail::lexicographical_compare(first1 + 1, last1, first2 + 1, last2); + : sprout::detail::lexicographical_compare(sprout::next(first1), last1, sprout::next(first2), last2); } template SPROUT_CONSTEXPR bool lexicographical_compare( @@ -123,7 +124,7 @@ namespace sprout { ? true : comp(*first2, *first1) ? false - : sprout::detail::lexicographical_compare(first1 + 1, last1, first2 + 1, last2, comp); + : sprout::detail::lexicographical_compare(sprout::next(first1), last1, sprout::next(first2), last2, comp); } } // namespace detail } // namespace sprout diff --git a/sprout/detail/iterator.hpp b/sprout/detail/iterator.hpp index 4330f43f..eb9b2a06 100644 --- a/sprout/detail/iterator.hpp +++ b/sprout/detail/iterator.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace sprout { namespace detail { @@ -15,7 +16,7 @@ namespace sprout { Iterator last ) { - return first == last ? 0 : 1 + sprout::detail::distance(first + 1, last); + return first == last ? 0 : 1 + sprout::detail::distance(sprout::next(first), last); } template @@ -30,7 +31,7 @@ namespace sprout { ? current : first2 == last ? -current - : sprout::detail::bidirectional_distance_impl(first1 + 1, first2 - 1, last, current + 1) + : sprout::detail::bidirectional_distance_impl(sprout::next(first1), sprout::prev(first2), last, current + 1) ; } // @@ -42,7 +43,7 @@ namespace sprout { Iterator last ) { - return first == last ? 0 : sprout::detail::bidirectional_distance_impl(first + 1, first - 1, last); + return first == last ? 0 : sprout::detail::bidirectional_distance_impl(sprout::next(first), sprout::prev(first), last); } } // namespace detail } // namespace sprout diff --git a/sprout/detail/overlap_count.hpp b/sprout/detail/overlap_count.hpp index 485a5bc6..c4c21669 100644 --- a/sprout/detail/overlap_count.hpp +++ b/sprout/detail/overlap_count.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace sprout { namespace detail { @@ -17,8 +18,8 @@ namespace sprout { return first == last ? 0 : *first == value - ? 1 + sprout::detail::overlap_count_impl(first + 1, last, value) - : sprout::detail::overlap_count_impl(first + 1, last, *first) + ? 1 + sprout::detail::overlap_count_impl(sprout::next(first), last, value) + : sprout::detail::overlap_count_impl(sprout::next(first), last, *first) ; } // @@ -32,7 +33,7 @@ namespace sprout { { return first == last ? 0 - : sprout::detail::overlap_count_impl(first + 1, last, *first) + : sprout::detail::overlap_count_impl(sprout::next(first), last, *first) ; } @@ -47,8 +48,8 @@ namespace sprout { return first == last ? 0 : pred(*first, value) - ? 1 + sprout::detail::overlap_count_impl(first + 1, last, pred, value) - : sprout::detail::overlap_count_impl(first + 1, last, pred, *first) + ? 1 + sprout::detail::overlap_count_impl(sprout::next(first), last, pred, value) + : sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first) ; } // @@ -63,7 +64,7 @@ namespace sprout { { return first == last ? 0 - : sprout::detail::overlap_count_impl(first + 1, last, pred, *first) + : sprout::detail::overlap_count_impl(sprout::next(first), last, pred, *first) ; } } // namespace detail diff --git a/sprout/detail/overlap_count_2.hpp b/sprout/detail/overlap_count_2.hpp index 0372bac3..347c9434 100644 --- a/sprout/detail/overlap_count_2.hpp +++ b/sprout/detail/overlap_count_2.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace sprout { namespace detail { @@ -20,10 +21,10 @@ namespace sprout { { return first1 != last1 && first2 != last2 ? comp(*first1, *first2) - ? sprout::detail::overlap_count_2(first1 + 1, last1, first2, last2, comp) + ? sprout::detail::overlap_count_2(sprout::next(first1), last1, first2, last2, comp) : comp(*first2, *first1) - ? sprout::detail::overlap_count_2(first1, last1, first2 + 1, last2, comp) - : 1 + sprout::detail::overlap_count_2(first1 + 1, last1, first2 + 1, last2, comp) + ? sprout::detail::overlap_count_2(first1, last1, sprout::next(first2), last2, comp) + : 1 + sprout::detail::overlap_count_2(sprout::next(first1), last1, sprout::next(first2), last2, comp) : 0 ; } @@ -40,10 +41,10 @@ namespace sprout { { return first1 != last1 && first2 != last2 ? *first1 < *first2 - ? sprout::detail::overlap_count_2(first1 + 1, last1, first2, last2) + ? sprout::detail::overlap_count_2(sprout::next(first1), last1, first2, last2) : *first2 < *first1 - ? sprout::detail::overlap_count_2(first1, last1, first2 + 1, last2) - : 1 + sprout::detail::overlap_count_2(first1 + 1, last1, first2 + 1, last2) + ? sprout::detail::overlap_count_2(first1, last1, sprout::next(first2), last2) + : 1 + sprout::detail::overlap_count_2(sprout::next(first1), last1, sprout::next(first2), last2) : 0 ; } diff --git a/sprout/functional/hash/hash.hpp b/sprout/functional/hash/hash.hpp index df4d1742..e56a9bba 100644 --- a/sprout/functional/hash/hash.hpp +++ b/sprout/functional/hash/hash.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include namespace sprout { @@ -162,7 +163,7 @@ namespace sprout { template SPROUT_CONSTEXPR std::size_t hash_range(std::size_t seed, Iterator first, Iterator last) { return first != last - ? sprout::hash_range(sprout::hash_combine(seed, *first), first + 1, last) + ? sprout::hash_range(sprout::hash_combine(seed, *first), sprout::next(first), last) : seed ; } diff --git a/sprout/iterator.hpp b/sprout/iterator.hpp index d79f97f6..e0aed73d 100644 --- a/sprout/iterator.hpp +++ b/sprout/iterator.hpp @@ -2,8 +2,7 @@ #define SPROUT_ITERATOR_HPP #include -#include -#include +#include #include #endif // #ifndef SPROUT_ITERATOR_HPP diff --git a/sprout/iterator/next.hpp b/sprout/iterator/next.hpp index a595d01e..13324e2e 100644 --- a/sprout/iterator/next.hpp +++ b/sprout/iterator/next.hpp @@ -1,5 +1,6 @@ #ifndef SPROUT_ITERATOR_NEXT_HPP #define SPROUT_ITERATOR_NEXT_HPP + #include #include #include @@ -59,6 +60,18 @@ namespace sprout { static_cast::type>::iterator_category*>(nullptr) ); } + template + SPROUT_CONSTEXPR typename std::decay::type next( + Iterator&& it, + typename std::iterator_traits::type>::difference_type n + ) + { + return sprout::detail::next_impl( + sprout::forward(it), + n, + static_cast::type>::iterator_category*>(nullptr) + ); + } } // namespace sprout #endif // #ifndef SPROUT_ITERATOR_NEXT_HPP diff --git a/sprout/iterator/operation.hpp b/sprout/iterator/operation.hpp new file mode 100644 index 00000000..27cb5709 --- /dev/null +++ b/sprout/iterator/operation.hpp @@ -0,0 +1,8 @@ +#ifndef SPROUT_ITERATOR_OPERATION_HPP +#define SPROUT_ITERATOR_OPERATION_HPP + +#include +#include +#include + +#endif // #ifndef SPROUT_ITERATOR_OPERATION_HPP diff --git a/sprout/iterator/prev.hpp b/sprout/iterator/prev.hpp index d1b2faa4..195edd4b 100644 --- a/sprout/iterator/prev.hpp +++ b/sprout/iterator/prev.hpp @@ -60,6 +60,18 @@ namespace sprout { static_cast::type>::iterator_category*>(nullptr) ); } + template + SPROUT_CONSTEXPR typename std::decay::type prev( + Iterator&& it, + typename std::iterator_traits::type>::difference_type n + ) + { + return sprout::detail::prev_impl( + sprout::forward(it), + n, + static_cast::type>::iterator_category*>(nullptr) + ); + } } // namespace sprout #endif // #ifndef SPROUT_ITERATOR_PREV_HPP diff --git a/sprout/operation/fixed/append.hpp b/sprout/operation/fixed/append.hpp index 666cdfdf..7bfee9c6 100644 --- a/sprout/operation/fixed/append.hpp +++ b/sprout/operation/fixed/append.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { @@ -40,10 +41,10 @@ namespace sprout { sprout::size(cont) + sprout::size(input), (Indexes < sprout::fixed_container_traits::fixed_size + size ? (Indexes < pos - ? *(sprout::fixed_begin(cont) + Indexes) + ? *sprout::next(sprout::fixed_begin(cont), Indexes) : Indexes < pos + size - ? *(sprout::begin(input) + Indexes - pos) - : *(sprout::fixed_begin(cont) + Indexes - size) + ? *sprout::next(sprout::begin(input), Indexes - pos) + : *sprout::next(sprout::fixed_begin(cont), Indexes - size) ) : typename sprout::fixed_container_traits::value_type() )... @@ -81,7 +82,7 @@ namespace sprout { return sprout::fixed::detail::append_impl::type>( cont, typename sprout::index_range<0, sprout::fixed_container_traits::type>::fixed_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::begin(cont) + pos), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::next(sprout::begin(cont), pos)), sprout::size(input), input ); diff --git a/sprout/operation/fixed/erase.hpp b/sprout/operation/fixed/erase.hpp index 74c49011..4a14da6a 100644 --- a/sprout/operation/fixed/erase.hpp +++ b/sprout/operation/fixed/erase.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { @@ -39,8 +40,8 @@ namespace sprout { sprout::size(cont) - 1, (Indexes < sprout::fixed_container_traits::fixed_size - 1 ? (Indexes < pos - ? *(sprout::fixed_begin(cont) + Indexes) - : *(sprout::fixed_begin(cont) + Indexes + 1) + ? *sprout::next(sprout::fixed_begin(cont), Indexes) + : *sprout::next(sprout::fixed_begin(cont), Indexes + 1) ) : typename sprout::fixed_container_traits::value_type() )... @@ -74,7 +75,7 @@ namespace sprout { return sprout::fixed::detail::erase_impl::type>( cont, typename sprout::index_range<0, sprout::fixed_container_traits::type>::fixed_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::begin(cont) + pos) + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::next(sprout::begin(cont), pos)) ); } } // namespace fixed diff --git a/sprout/operation/fixed/erase_n.hpp b/sprout/operation/fixed/erase_n.hpp index 12d61e86..fc672814 100644 --- a/sprout/operation/fixed/erase_n.hpp +++ b/sprout/operation/fixed/erase_n.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { @@ -39,8 +40,8 @@ namespace sprout { sprout::size(cont) - N, (Indexes < sprout::fixed_container_traits::fixed_size - N ? (Indexes < pos - ? *(sprout::fixed_begin(cont) + Indexes) - : *(sprout::fixed_begin(cont) + Indexes + N) + ? *sprout::next(sprout::fixed_begin(cont), Indexes) + : *sprout::next(sprout::fixed_begin(cont), Indexes + N) ) : typename sprout::fixed_container_traits::value_type() )... @@ -74,7 +75,7 @@ namespace sprout { return sprout::fixed::detail::erase_n_impl::type>( cont, typename sprout::index_range<0, sprout::fixed_container_traits::type>::fixed_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::begin(cont) + pos) + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::next(sprout::begin(cont), pos)) ); } } // namespace fixed diff --git a/sprout/operation/fixed/insert.hpp b/sprout/operation/fixed/insert.hpp index 06774b81..78a1efe9 100644 --- a/sprout/operation/fixed/insert.hpp +++ b/sprout/operation/fixed/insert.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -42,10 +43,10 @@ namespace sprout { sprout::size(cont) + 1 + sizeof...(Values), (Indexes < sprout::fixed_container_traits::fixed_size + 1 + sizeof...(Values) ? (Indexes < pos - ? *(sprout::fixed_begin(cont) + Indexes) + ? *sprout::next(sprout::fixed_begin(cont), Indexes) : Indexes < pos + 1 + sizeof...(Values) ? sprout::detail::param_at::value_type>(Indexes - pos, v, values...) - : *(sprout::fixed_begin(cont) + Indexes - (1 + sizeof...(Values))) + : *sprout::next(sprout::fixed_begin(cont), Indexes - (1 + sizeof...(Values))) ) : typename sprout::fixed_container_traits::value_type() )... @@ -85,7 +86,7 @@ namespace sprout { return sprout::fixed::detail::insert_impl::type>( cont, typename sprout::index_range<0, sprout::fixed_container_traits::type>::fixed_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::begin(cont) + pos), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::next(sprout::begin(cont), pos)), v, values... ); diff --git a/sprout/operation/fixed/insert_n.hpp b/sprout/operation/fixed/insert_n.hpp index af6bdf28..7a25837f 100644 --- a/sprout/operation/fixed/insert_n.hpp +++ b/sprout/operation/fixed/insert_n.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -46,7 +47,7 @@ namespace sprout { ? *(sprout::fixed_begin(cont) + Indexes) : Indexes < pos + (1 + sizeof...(Values)) * N ? sprout::detail::param_at::value_type>((Indexes - pos) % (1 + sizeof...(Values)), v, values...) - : *(sprout::fixed_begin(cont) + Indexes - (1 + sizeof...(Values)) * N) + : *sprout::next(sprout::fixed_begin(cont), Indexes - (1 + sizeof...(Values)) * N) ) : typename sprout::fixed_container_traits::value_type() )... @@ -86,7 +87,7 @@ namespace sprout { return sprout::fixed::detail::insert_n_impl::type>( cont, typename sprout::index_range<0, sprout::fixed_container_traits::type>::fixed_size>::type(), - NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::begin(cont) + pos), + NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(cont), sprout::next(sprout::begin(cont), pos)), v, values... ); diff --git a/sprout/operation/fixed/realign.hpp b/sprout/operation/fixed/realign.hpp index d5599f58..d4927dbb 100644 --- a/sprout/operation/fixed/realign.hpp +++ b/sprout/operation/fixed/realign.hpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace sprout { namespace fixed { @@ -31,7 +32,7 @@ namespace sprout { { return sprout::make_clone( (Indexes < size - ? *(sprout::begin(cont) + Indexes) + ? *sprout::next(sprout::begin(cont), Indexes) : v )... ); @@ -64,7 +65,7 @@ namespace sprout { { return sprout::make_clone( (Indexes < size - ? *(sprout::begin(cont) + Indexes) + ? *sprout::next(sprout::begin(cont), Indexes) : typename sprout::fixed_container_traits::value_type() )... ); diff --git a/sprout/operation/fixed/resize.hpp b/sprout/operation/fixed/resize.hpp index 1663ae3a..7d99ab13 100644 --- a/sprout/operation/fixed/resize.hpp +++ b/sprout/operation/fixed/resize.hpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace sprout { namespace fixed { @@ -35,7 +36,7 @@ namespace sprout { { return sprout::make_clone( (Indexes < size - ? *(sprout::begin(cont) + Indexes) + ? *sprout::next(sprout::begin(cont), Indexes) : v )... ); @@ -68,7 +69,7 @@ namespace sprout { { return sprout::make_clone( (Indexes < size - ? *(sprout::begin(cont) + Indexes) + ? *sprout::next(sprout::begin(cont), Indexes) : typename sprout::fixed_container_traits::value_type() )... ); diff --git a/sprout/operation/fixed/resize_backward.hpp b/sprout/operation/fixed/resize_backward.hpp index 612229d8..515a7b90 100644 --- a/sprout/operation/fixed/resize_backward.hpp +++ b/sprout/operation/fixed/resize_backward.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include namespace sprout { @@ -32,7 +33,7 @@ namespace sprout { { return sprout::make_clone( (Indexes >= offset && Indexes < offset + size - ? *(sprout::begin(cont) + Indexes - offset) + ? *sprout::next(sprout::begin(cont), Indexes - offset) : v )... ); @@ -70,7 +71,7 @@ namespace sprout { { return sprout::make_clone( (Indexes >= offset && Indexes < offset + size - ? *(sprout::begin(cont) + Indexes - offset) + ? *sprout::next(sprout::begin(cont), Indexes - offset) : typename sprout::fixed_container_traits::value_type() )... ); diff --git a/sprout/string.hpp b/sprout/string.hpp index 67345f6d..ba1dc1e1 100644 --- a/sprout/string.hpp +++ b/sprout/string.hpp @@ -851,17 +851,17 @@ namespace std { // template T& get(sprout::basic_string& arr) SPROUT_NOEXCEPT { - static_assert(I < N, "tuple_element<>: index out of range"); + static_assert(I < N, "get: index out of range"); return arr[I]; } template SPROUT_CONSTEXPR T const& get(sprout::basic_string const& arr) SPROUT_NOEXCEPT { - static_assert(I < N, "tuple_element<>: index out of range"); + static_assert(I < N, "get: index out of range"); return arr[I]; } template T&& get(sprout::basic_string&& arr) SPROUT_NOEXCEPT { - return std::move(get(arr)); + return std::move(std::get(arr)); } } // namespace std diff --git a/sprout/sub_array.hpp b/sprout/sub_array.hpp index dbd12bc4..e1504f48 100644 --- a/sprout/sub_array.hpp +++ b/sprout/sub_array.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -290,48 +291,48 @@ namespace sprout { } } iterator begin() { - return sprout::begin(get_array()) + first_; + return sprout::next(sprout::begin(get_array()), first_); } SPROUT_CONSTEXPR const_iterator begin() const { - return sprout::begin(get_array()) + first_; + return sprout::next(sprout::begin(get_array()), first_); } SPROUT_CONSTEXPR const_iterator cbegin() const { - return sprout::begin(get_array()) + first_; + return sprout::next(sprout::begin(get_array()), first_); } iterator end() { - return sprout::begin(get_array()) + last_; + return sprout::next(sprout::begin(get_array()), last_); } SPROUT_CONSTEXPR const_iterator end() const { - return sprout::begin(get_array()) + last_; + return sprout::next(sprout::begin(get_array()), last_); } SPROUT_CONSTEXPR const_iterator cend() const { - return sprout::begin(get_array()) + last_; + return sprout::next(sprout::begin(get_array()), last_); } reference operator[](size_type i) { - return *(sprout::begin(get_array()) + first_ + i); + return *sprout::next(sprout::begin(get_array()), first_ + i); } SPROUT_CONSTEXPR const_reference operator[](size_type i) const { - return *(sprout::begin(get_array()) + first_ + i); + return *sprout::next(sprout::begin(get_array()), first_ + i); } reference at(size_type i) { rangecheck(i); - return *(sprout::begin(get_array()) + first_ + i); + return *sprout::next(sprout::begin(get_array()), first_ + i); } const_reference at(size_type i) const { rangecheck(i); - return *(sprout::begin(get_array()) + first_ + i); + return *sprout::next(sprout::begin(get_array()), first_ + i); } reference front() { - return *(sprout::begin(get_array()) + first_); + return *sprout::next(sprout::begin(get_array()), first_); } SPROUT_CONSTEXPR const_reference front() const { - return *(sprout::begin(get_array()) + first_); + return *sprout::next(sprout::begin(get_array()), first_); } reference back() { - return *(sprout::begin(get_array()) + (last_ - 1)); + return *sprout::next(sprout::begin(get_array()), last_ - 1); } SPROUT_CONSTEXPR const_reference back() const { - return *(sprout::begin(get_array()) + (last_ - 1)); + return *sprout::next(sprout::begin(get_array()), last_ - 1); } pointer data() { return get_array().data() + first_; @@ -506,8 +507,8 @@ namespace sprout { { return clone_type( cloned, - sprout::begin(cloned) + sprout::fixed_begin_offset(other), - sprout::begin(cloned) + sprout::fixed_begin_offset(other) + size + sprout::next(sprout::begin(cloned), sprout::fixed_begin_offset(other)), + sprout::next(sprout::begin(cloned), sprout::fixed_begin_offset(other) + size) ); } template @@ -519,8 +520,8 @@ namespace sprout { { return clone_type( cloned, - sprout::begin(cloned) + sprout::fixed_begin_offset(other), - sprout::begin(cloned) + sprout::fixed_begin_offset(other) + size + sprout::next(sprout::begin(cloned), sprout::fixed_begin_offset(other)), + sprout::next(sprout::begin(cloned), sprout::fixed_begin_offset(other) + size) ); } public: @@ -770,7 +771,11 @@ namespace sprout { typename sprout::fixed_container_traits::difference_type last ) { - return sprout::sub_array(arr.get_array(), sprout::begin(arr) + first, sprout::begin(arr) + last); + return sprout::sub_array( + arr.get_array(), + sprout::next(sprout::begin(arr), first), + sprout::next(sprout::begin(arr), last) + ); } template SPROUT_CONSTEXPR inline typename std::enable_if::value, sprout::sub_array >::type csub( @@ -859,7 +864,11 @@ namespace sprout { typename sprout::fixed_container_traits::difference_type last ) { - return sprout::sub_array(arr.get_array(), sprout::begin(arr) + first, sprout::begin(arr) + last); + return sprout::sub_array( + arr.get_array(), + sprout::next(sprout::begin(arr), first), + sprout::next(sprout::begin(arr), last) + ); } template SPROUT_CONSTEXPR inline typename std::enable_if::value, sprout::sub_array >::type sub_copy( @@ -918,18 +927,18 @@ namespace std { // get // template - T& get(sprout::sub_array& arr) SPROUT_NOEXCEPT { - static_assert(I < sprout::fixed_container_traits >::fixed_size, "tuple_element<>: index out of range"); - return *(sprout::fixed_begin(arr) + I); + T& get(sprout::sub_array& arr) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(*sprout::next(sprout::fixed_begin(arr), I))) { + static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); + return *sprout::next(sprout::fixed_begin(arr), I); } template - SPROUT_CONSTEXPR T const& get(sprout::sub_array const& arr) SPROUT_NOEXCEPT { - static_assert(I < sprout::fixed_container_traits >::fixed_size, "tuple_element<>: index out of range"); - return *(sprout::fixed_begin(arr) + I); + SPROUT_CONSTEXPR T const& get(sprout::sub_array const& arr) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(*sprout::next(sprout::fixed_begin(arr), I))) { + static_assert(I < sprout::fixed_container_traits >::fixed_size, "get: index out of range"); + return *sprout::next(sprout::fixed_begin(arr), I); } template - T&& get(sprout::sub_array&& arr) SPROUT_NOEXCEPT { - return std::move(get(arr)); + T&& get(sprout::sub_array&& arr) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::move(std::get(arr)))) { + return std::move(std::get(arr)); } } // namespace std