diff --git a/sprout/algorithm/fixed/copy.hpp b/sprout/algorithm/fixed/copy.hpp index aff85283..2bf191e2 100644 --- a/sprout/algorithm/fixed/copy.hpp +++ b/sprout/algorithm/fixed/copy.hpp @@ -27,7 +27,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size @@ -66,7 +66,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/copy_backward.hpp b/sprout/algorithm/fixed/copy_backward.hpp index 49432ab9..f235a706 100644 --- a/sprout/algorithm/fixed/copy_backward.hpp +++ b/sprout/algorithm/fixed/copy_backward.hpp @@ -27,7 +27,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes < offset && Indexes + size >= static_cast(offset) && Indexes + input_size >= static_cast(offset) @@ -66,7 +66,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/copy_if.hpp b/sprout/algorithm/fixed/copy_if.hpp index 3c871329..c1a389f1 100644 --- a/sprout/algorithm/fixed/copy_if.hpp +++ b/sprout/algorithm/fixed/copy_if.hpp @@ -25,7 +25,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/copy_n.hpp b/sprout/algorithm/fixed/copy_n.hpp index 04b58d77..2293021f 100644 --- a/sprout/algorithm/fixed/copy_n.hpp +++ b/sprout/algorithm/fixed/copy_n.hpp @@ -36,7 +36,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/fill.hpp b/sprout/algorithm/fixed/fill.hpp index 99feb181..f7fe6d2f 100644 --- a/sprout/algorithm/fixed/fill.hpp +++ b/sprout/algorithm/fixed/fill.hpp @@ -21,7 +21,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type size ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont), (Indexes >= offset && Indexes < offset + size diff --git a/sprout/algorithm/fixed/generate.hpp b/sprout/algorithm/fixed/generate.hpp index a9ebcda0..2a670f61 100644 --- a/sprout/algorithm/fixed/generate.hpp +++ b/sprout/algorithm/fixed/generate.hpp @@ -99,7 +99,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(cont, sprout::size(cont), args...); + return sprout::remake_clone(cont, sprout::size(cont), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/merge.hpp b/sprout/algorithm/fixed/merge.hpp index a5b27f28..ae8bc5b4 100644 --- a/sprout/algorithm/fixed/merge.hpp +++ b/sprout/algorithm/fixed/merge.hpp @@ -28,7 +28,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/partition_copy.hpp b/sprout/algorithm/fixed/partition_copy.hpp index 01007f29..da2f9a84 100644 --- a/sprout/algorithm/fixed/partition_copy.hpp +++ b/sprout/algorithm/fixed/partition_copy.hpp @@ -25,7 +25,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/remove_copy.hpp b/sprout/algorithm/fixed/remove_copy.hpp index 2ed0adc6..bf49246f 100644 --- a/sprout/algorithm/fixed/remove_copy.hpp +++ b/sprout/algorithm/fixed/remove_copy.hpp @@ -25,7 +25,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/remove_copy_if.hpp b/sprout/algorithm/fixed/remove_copy_if.hpp index 8c004baa..5cd75d7c 100644 --- a/sprout/algorithm/fixed/remove_copy_if.hpp +++ b/sprout/algorithm/fixed/remove_copy_if.hpp @@ -25,7 +25,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/replace_copy.hpp b/sprout/algorithm/fixed/replace_copy.hpp index 6c6da3df..ecc01963 100644 --- a/sprout/algorithm/fixed/replace_copy.hpp +++ b/sprout/algorithm/fixed/replace_copy.hpp @@ -30,7 +30,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size @@ -75,7 +75,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/replace_copy_if.hpp b/sprout/algorithm/fixed/replace_copy_if.hpp index 317021ef..e880822d 100644 --- a/sprout/algorithm/fixed/replace_copy_if.hpp +++ b/sprout/algorithm/fixed/replace_copy_if.hpp @@ -29,7 +29,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size @@ -74,7 +74,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/reverse_copy.hpp b/sprout/algorithm/fixed/reverse_copy.hpp index d8403a4b..7bdfd1b1 100644 --- a/sprout/algorithm/fixed/reverse_copy.hpp +++ b/sprout/algorithm/fixed/reverse_copy.hpp @@ -27,7 +27,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size @@ -66,7 +66,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/rotate_copy.hpp b/sprout/algorithm/fixed/rotate_copy.hpp index 7ff31ce8..5563b4c1 100644 --- a/sprout/algorithm/fixed/rotate_copy.hpp +++ b/sprout/algorithm/fixed/rotate_copy.hpp @@ -28,7 +28,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size @@ -72,7 +72,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -105,7 +105,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/set_difference.hpp b/sprout/algorithm/fixed/set_difference.hpp index 9604b6ba..0d07e281 100644 --- a/sprout/algorithm/fixed/set_difference.hpp +++ b/sprout/algorithm/fixed/set_difference.hpp @@ -28,7 +28,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/set_intersection.hpp b/sprout/algorithm/fixed/set_intersection.hpp index 77d5d4a6..e82ab1b2 100644 --- a/sprout/algorithm/fixed/set_intersection.hpp +++ b/sprout/algorithm/fixed/set_intersection.hpp @@ -28,7 +28,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/set_symmetric_difference.hpp b/sprout/algorithm/fixed/set_symmetric_difference.hpp index 838aba4f..2312e11b 100644 --- a/sprout/algorithm/fixed/set_symmetric_difference.hpp +++ b/sprout/algorithm/fixed/set_symmetric_difference.hpp @@ -28,7 +28,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/set_union.hpp b/sprout/algorithm/fixed/set_union.hpp index 2a353d4a..a7f9dfc0 100644 --- a/sprout/algorithm/fixed/set_union.hpp +++ b/sprout/algorithm/fixed/set_union.hpp @@ -28,7 +28,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/shuffle.hpp b/sprout/algorithm/fixed/shuffle.hpp index db9f4680..110537d3 100644 --- a/sprout/algorithm/fixed/shuffle.hpp +++ b/sprout/algorithm/fixed/shuffle.hpp @@ -63,7 +63,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type size ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont), (Indexes >= offset && Indexes < offset + size diff --git a/sprout/algorithm/fixed/stable_partition_copy.hpp b/sprout/algorithm/fixed/stable_partition_copy.hpp index 35c9d7fb..7a683043 100644 --- a/sprout/algorithm/fixed/stable_partition_copy.hpp +++ b/sprout/algorithm/fixed/stable_partition_copy.hpp @@ -25,7 +25,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -62,7 +62,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/stable_sort.hpp b/sprout/algorithm/fixed/stable_sort.hpp index dcbcb2dc..23d44612 100644 --- a/sprout/algorithm/fixed/stable_sort.hpp +++ b/sprout/algorithm/fixed/stable_sort.hpp @@ -35,7 +35,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(cont, sprout::size(cont), args...); + return sprout::remake_clone(cont, sprout::size(cont), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/swap_element_copy.hpp b/sprout/algorithm/fixed/swap_element_copy.hpp index fe0f3b43..5fc3a233 100644 --- a/sprout/algorithm/fixed/swap_element_copy.hpp +++ b/sprout/algorithm/fixed/swap_element_copy.hpp @@ -29,7 +29,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size @@ -78,7 +78,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/transform.hpp b/sprout/algorithm/fixed/transform.hpp index c59d809d..3b4c6c08 100644 --- a/sprout/algorithm/fixed/transform.hpp +++ b/sprout/algorithm/fixed/transform.hpp @@ -28,7 +28,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size @@ -70,7 +70,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -131,7 +131,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type input_size ) { - return sprout::remake_clone( + return sprout::remake_clone( result, sprout::size(result), (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size @@ -176,7 +176,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/algorithm/fixed/unique_copy.hpp b/sprout/algorithm/fixed/unique_copy.hpp index 3d0051b3..6c456569 100644 --- a/sprout/algorithm/fixed/unique_copy.hpp +++ b/sprout/algorithm/fixed/unique_copy.hpp @@ -25,7 +25,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args..., head); + return sprout::remake_clone(result, sprout::size(result), args..., head); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -79,7 +79,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args..., head); + return sprout::remake_clone(result, sprout::size(result), args..., head); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/detail/container_complate.hpp b/sprout/detail/container_complate.hpp index d67b087e..373531d0 100644 --- a/sprout/detail/container_complate.hpp +++ b/sprout/detail/container_complate.hpp @@ -19,7 +19,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -42,7 +42,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -68,7 +68,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/detail/container_complate_backward.hpp b/sprout/detail/container_complate_backward.hpp index 23174f1a..56718c87 100644 --- a/sprout/detail/container_complate_backward.hpp +++ b/sprout/detail/container_complate_backward.hpp @@ -19,7 +19,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -42,7 +42,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -68,7 +68,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/fixed_container/clone.hpp b/sprout/fixed_container/clone.hpp index fcc1980b..184fe3e7 100644 --- a/sprout/fixed_container/clone.hpp +++ b/sprout/fixed_container/clone.hpp @@ -1,28 +1,21 @@ #ifndef SPROUT_FIXED_CONTAINER_CLONE_HPP #define SPROUT_FIXED_CONTAINER_CLONE_HPP +#include #include #include +#include namespace sprout { // // clone // template - inline typename sprout::fixed_container_traits::clone_type clone(Container& cont) { - return sprout::clone_functor().template operator()(cont); - } - template - SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::clone_type clone(Container const& cont) { - return sprout::clone_functor().template operator()(cont); - } - - // - // cclone - // - template - SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::clone_type cclone(Container const& cont) { - return sprout::clone_functor().template operator()(cont); + SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits< + typename std::remove_reference::type + >::clone_type clone(Container&& cont) { + typedef typename std::decay::type container_type; + return sprout::clone_functor().template operator()(sprout::forward(cont)); } } // namespace sprout diff --git a/sprout/fixed_container/get_fixed.hpp b/sprout/fixed_container/get_fixed.hpp index 21d6906b..bb1a6096 100644 --- a/sprout/fixed_container/get_fixed.hpp +++ b/sprout/fixed_container/get_fixed.hpp @@ -22,7 +22,7 @@ namespace sprout { // template SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::fixed_container_type const& get_cfixed(Container const& cont) { - return sprout::get_fixed_functor()(cont); + return sprout::get_fixed_functor().template operator()(cont); } // @@ -30,7 +30,7 @@ namespace sprout { // template SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::fixed_container_type get_fixed_copy(Container const& cont) { - return sprout::get_fixed_functor()(cont); + return sprout::get_fixed_functor().template operator()(cont); } } // namespace sprout diff --git a/sprout/fixed_container/make_clone.hpp b/sprout/fixed_container/make_clone.hpp index 1a4bd272..6076a231 100644 --- a/sprout/fixed_container/make_clone.hpp +++ b/sprout/fixed_container/make_clone.hpp @@ -1,16 +1,21 @@ #ifndef SPROUT_FIXED_CONTAINER_MAKE_CLONE_HPP #define SPROUT_FIXED_CONTAINER_MAKE_CLONE_HPP +#include #include #include +#include namespace sprout { // // make_clone // template - SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::clone_type make_clone(Args const&... args) { - return sprout::make_clone_functor().template operator()(args...); + SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits< + typename std::remove_reference::type + >::clone_type make_clone(Args&&... args) { + typedef typename std::remove_reference::type container_type; + return sprout::make_clone_functor().template operator()(sprout::forward(args)...); } } // namespace sprout diff --git a/sprout/fixed_container/remake_clone.hpp b/sprout/fixed_container/remake_clone.hpp index 14a96dc6..d0f5e020 100644 --- a/sprout/fixed_container/remake_clone.hpp +++ b/sprout/fixed_container/remake_clone.hpp @@ -1,43 +1,30 @@ #ifndef SPROUT_FIXED_CONTAINER_REMAKE_CLONE_HPP #define SPROUT_FIXED_CONTAINER_REMAKE_CLONE_HPP +#include #include #include +#include namespace sprout { // // remake_clone // template - inline typename sprout::fixed_container_traits::clone_type remake_clone( - Other& other, + SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits< + typename std::remove_reference::type + >::clone_type remake_clone( + Other&& other, typename sprout::fixed_container_traits::difference_type size, - Args const&... args + Args&&... args ) { - return sprout::remake_clone_functor().template operator()(other, size, args...); - } - template - SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::clone_type remake_clone( - Other const& other, - typename sprout::fixed_container_traits::difference_type size, - Args const&... args - ) - { - return sprout::remake_clone_functor().template operator()(other, size, args...); - } - - // - // remake_cclone - // - template - SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits::clone_type remake_cclone( - Other const& other, - typename sprout::fixed_container_traits::difference_type size, - Args const&... args - ) - { - return sprout::remake_clone_functor().template operator()(other, size, args...); + typedef typename std::remove_reference::type container_type; + return sprout::remake_clone_functor().template operator()( + sprout::forward(other), + size, + sprout::forward(args)... + ); } } // namespace sprout diff --git a/sprout/fixed_container/traits.hpp b/sprout/fixed_container/traits.hpp index 8b73646a..a732570d 100644 --- a/sprout/fixed_container/traits.hpp +++ b/sprout/fixed_container/traits.hpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace sprout { namespace detail { @@ -114,6 +115,10 @@ namespace sprout { return cont; } }; + template + struct get_fixed_functor + : public sprout::get_fixed_functor + {}; // // clone_functor @@ -121,13 +126,15 @@ namespace sprout { template struct clone_functor { public: - typename sprout::fixed_container_traits::clone_type operator()(Container& cont) const { - return typename sprout::fixed_container_traits::clone_type(cont); - } - SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()(Container const& cont) const { - return typename sprout::fixed_container_traits::clone_type(cont); + template + SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()(Other&& cont) const { + return typename sprout::fixed_container_traits::clone_type(sprout::forward(cont)); } }; + template + struct clone_functor + : public sprout::clone_functor + {}; // // make_clone_functor @@ -136,10 +143,14 @@ namespace sprout { struct make_clone_functor { public: template - SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()(Args const&... args) const { - return typename sprout::fixed_container_traits::clone_type{{args...}}; + SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()(Args&&... args) const { + return typename sprout::fixed_container_traits::clone_type{{sprout::forward(args)...}}; } }; + template + struct make_clone_functor + : public sprout::make_clone_functor + {}; // // remake_clone_functor @@ -147,25 +158,20 @@ namespace sprout { template struct remake_clone_functor { public: - template - typename sprout::fixed_container_traits::clone_type operator()( - Other& other, - typename sprout::fixed_container_traits::difference_type size, - Args const&... args - ) const - { - return sprout::make_clone_functor().template operator()(args...); - } template SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()( - Other const& other, + Other&& other, typename sprout::fixed_container_traits::difference_type size, - Args const&... args + Args&&... args ) const { - return sprout::make_clone_functor().template operator()(args...); + return sprout::make_clone_functor().template operator()(sprout::forward(args)...); } }; + template + struct remake_clone_functor + : public sprout::remake_clone_functor + {}; } // namespace sprout #endif // #ifndef SPROUT_FIXED_CONTAINER_TRAITS_HPP diff --git a/sprout/numeric/fixed/adjacent_difference.hpp b/sprout/numeric/fixed/adjacent_difference.hpp index 62ed286b..84cdb64b 100644 --- a/sprout/numeric/fixed/adjacent_difference.hpp +++ b/sprout/numeric/fixed/adjacent_difference.hpp @@ -20,7 +20,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -46,7 +46,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -78,7 +78,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -132,7 +132,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -159,7 +159,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -193,7 +193,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/numeric/fixed/iota.hpp b/sprout/numeric/fixed/iota.hpp index 8b7634a5..f47f5550 100644 --- a/sprout/numeric/fixed/iota.hpp +++ b/sprout/numeric/fixed/iota.hpp @@ -21,7 +21,7 @@ namespace sprout { typename sprout::fixed_container_traits::size_type size ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont), (Indexes >= offset && Indexes < offset + size diff --git a/sprout/numeric/fixed/partial_sum.hpp b/sprout/numeric/fixed/partial_sum.hpp index 502627be..0005e127 100644 --- a/sprout/numeric/fixed/partial_sum.hpp +++ b/sprout/numeric/fixed/partial_sum.hpp @@ -20,7 +20,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -46,7 +46,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -78,7 +78,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -132,7 +132,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -159,7 +159,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< @@ -193,7 +193,7 @@ namespace sprout { Args const&... args ) { - return sprout::remake_clone(result, sprout::size(result), args...); + return sprout::remake_clone(result, sprout::size(result), args...); } template SPROUT_CONSTEXPR inline typename std::enable_if< diff --git a/sprout/operation/fixed/append.hpp b/sprout/operation/fixed/append.hpp index 7bfee9c6..3f00b028 100644 --- a/sprout/operation/fixed/append.hpp +++ b/sprout/operation/fixed/append.hpp @@ -36,7 +36,7 @@ namespace sprout { Input const& input ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont) + sprout::size(input), (Indexes < sprout::fixed_container_traits::fixed_size + size diff --git a/sprout/operation/fixed/erase.hpp b/sprout/operation/fixed/erase.hpp index 4a14da6a..f13c889e 100644 --- a/sprout/operation/fixed/erase.hpp +++ b/sprout/operation/fixed/erase.hpp @@ -35,7 +35,7 @@ namespace sprout { typename sprout::fixed_container_traits::difference_type pos ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont) - 1, (Indexes < sprout::fixed_container_traits::fixed_size - 1 diff --git a/sprout/operation/fixed/erase_n.hpp b/sprout/operation/fixed/erase_n.hpp index fc672814..2df92093 100644 --- a/sprout/operation/fixed/erase_n.hpp +++ b/sprout/operation/fixed/erase_n.hpp @@ -35,7 +35,7 @@ namespace sprout { typename sprout::fixed_container_traits::difference_type pos ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont) - N, (Indexes < sprout::fixed_container_traits::fixed_size - N diff --git a/sprout/operation/fixed/insert.hpp b/sprout/operation/fixed/insert.hpp index 78a1efe9..5e59b4e1 100644 --- a/sprout/operation/fixed/insert.hpp +++ b/sprout/operation/fixed/insert.hpp @@ -38,7 +38,7 @@ namespace sprout { Values const&... values ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont) + 1 + sizeof...(Values), (Indexes < sprout::fixed_container_traits::fixed_size + 1 + sizeof...(Values) diff --git a/sprout/operation/fixed/insert_n.hpp b/sprout/operation/fixed/insert_n.hpp index 7a25837f..c0572ebd 100644 --- a/sprout/operation/fixed/insert_n.hpp +++ b/sprout/operation/fixed/insert_n.hpp @@ -39,7 +39,7 @@ namespace sprout { Values const&... values ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont) + (1 + sizeof...(Values)) * N, (Indexes < sprout::fixed_container_traits::fixed_size + (1 + sizeof...(Values)) * N diff --git a/sprout/operation/fixed/set.hpp b/sprout/operation/fixed/set.hpp index 5857a284..f2a03879 100644 --- a/sprout/operation/fixed/set.hpp +++ b/sprout/operation/fixed/set.hpp @@ -31,7 +31,7 @@ namespace sprout { T const& v ) { - return sprout::remake_clone( + return sprout::remake_clone( cont, sprout::size(cont), (Indexes != pos diff --git a/sprout/pit.hpp b/sprout/pit.hpp index 4a5a4b91..e61b5816 100644 --- a/sprout/pit.hpp +++ b/sprout/pit.hpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace sprout { // @@ -216,10 +217,8 @@ namespace sprout { private: typedef typename sprout::fixed_container_traits >::clone_type clone_type; public: - clone_type operator()(sprout::pit& cont) const { - return clone_type(); - } - SPROUT_CONSTEXPR clone_type operator()(sprout::pit const& cont) const { + template + SPROUT_CONSTEXPR clone_type operator()(Other&& cont) const { return clone_type(); } }; @@ -234,8 +233,8 @@ namespace sprout { typedef typename sprout::fixed_container_traits >::internal_type internal_type; public: template - SPROUT_CONSTEXPR clone_type operator()(Args const&... args) const { - return sprout::make_clone(args...); + SPROUT_CONSTEXPR clone_type operator()(Args&&... args) const { + return sprout::make_clone(sprout::forward(args)...); } }; @@ -248,23 +247,14 @@ namespace sprout { typedef typename sprout::fixed_container_traits >::clone_type clone_type; typedef typename sprout::fixed_container_traits >::internal_type internal_type; public: - template - clone_type operator()( - Other& other, - typename sprout::fixed_container_traits >::difference_type size, - Args const&... args - ) const - { - return sprout::remake_clone(other, size, args...); - } template SPROUT_CONSTEXPR clone_type operator()( - Other const& other, + Other&& other, typename sprout::fixed_container_traits >::difference_type size, - Args const&... args + Args&&... args ) const { - return sprout::remake_clone(other, size, args...); + return sprout::remake_clone(sprout::forward(other), size, sprout::forward(args)...); } }; } // namespace sprout diff --git a/sprout/string.hpp b/sprout/string.hpp index a0b9ecae..806c12c9 100644 --- a/sprout/string.hpp +++ b/sprout/string.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION # include @@ -746,31 +747,31 @@ namespace sprout { static SPROUT_CONSTEXPR clone_type make_impl(typename clone_type::size_type size) { return clone_type{{}, size}; } - template + template static SPROUT_CONSTEXPR typename std::enable_if< - S != sizeof...(Args), + S == sizeof...(Tail), clone_type - >::type make_impl(typename clone_type::size_type size, T const& head, Args const&... tail) { - return make_impl(size, tail..., S < size ? head : T()); + >::type make_impl(typename clone_type::size_type size, Head&& head, Tail&&... tail) { + return clone_type{{sprout::forward(tail)..., sprout::forward(head)}, size}; } - template + template static SPROUT_CONSTEXPR typename std::enable_if< - S == sizeof...(Args), + S != sizeof...(Tail), clone_type - >::type make_impl(typename clone_type::size_type size, T const& head, Args const&... tail) { - return clone_type{{tail..., head}, size}; + >::type make_impl(typename clone_type::size_type size, Head&& head, Tail&&... tail) { + return make_impl(size, sprout::forward(tail)..., S >= size ? T() : sprout::forward(head)); } public: static SPROUT_CONSTEXPR typename clone_type::size_type length() { return 0; } template - static SPROUT_CONSTEXPR typename clone_type::size_type length(T const& head, Tail const&... tail) { - return !head ? 0 : 1 + length(tail...); + static SPROUT_CONSTEXPR typename clone_type::size_type length(T const& head, Tail&&... tail) { + return !head ? 0 : 1 + length(sprout::forward(tail)...); } template - static SPROUT_CONSTEXPR clone_type make(typename clone_type::size_type size, Args const&... args) { - return make_impl<0>(size, args...); + static SPROUT_CONSTEXPR clone_type make(typename clone_type::size_type size, Args&&... args) { + return make_impl<0>(size, sprout::forward(args)...); } }; } // namespace detail @@ -785,8 +786,8 @@ namespace sprout { typedef sprout::detail::make_clone_functor_impl impl_type; public: template - SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()(Args const&... args) const { - return impl_type::make(impl_type::length(args...), args...); + SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()(Args&&... args) const { + return impl_type::make(impl_type::length(sprout::forward(args)...), sprout::forward(args)...); } }; @@ -801,21 +802,12 @@ namespace sprout { public: template SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()( - Other& other, + Other&& other, typename sprout::fixed_container_traits::difference_type size, - Args const&... args + Args&&... args ) const { - return impl_type::make(size, args...); - } - template - SPROUT_CONSTEXPR typename sprout::fixed_container_traits::clone_type operator()( - Other const& other, - typename sprout::fixed_container_traits::difference_type size, - Args const&... args - ) const - { - return impl_type::make(size, args...); + return impl_type::make(size, sprout::forward(args)...); } }; diff --git a/sprout/sub_array.hpp b/sprout/sub_array.hpp index 97153f71..0a047897 100644 --- a/sprout/sub_array.hpp +++ b/sprout/sub_array.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL @@ -486,12 +487,28 @@ namespace sprout { struct clone_functor > { private: typedef typename sprout::fixed_container_traits >::clone_type clone_type; - public: - clone_type operator()(sprout::sub_array& cont) const { - return clone_type(sprout::clone(sprout::get_fixed(cont)), sprout::fixed_begin_offset(cont), sprout::fixed_end_offset(cont)); + private: + template + SPROUT_CONSTEXPR clone_type make( + Other&& cont, + typename sprout::fixed_container_traits >::difference_type first, + typename sprout::fixed_container_traits >::difference_type last + ) const + { + return clone_type( + sprout::clone(sprout::get_fixed(sprout::forward(cont))), + first, + last + ); } - SPROUT_CONSTEXPR clone_type operator()(sprout::sub_array const& cont) const { - return clone_type(sprout::clone(sprout::get_fixed(cont)), sprout::fixed_begin_offset(cont), sprout::fixed_end_offset(cont)); + public: + template + SPROUT_CONSTEXPR clone_type operator()(Other&& cont) const { + return make( + sprout::forward(cont), + sprout::fixed_begin_offset(cont), + sprout::fixed_end_offset(cont) + ); } }; @@ -509,8 +526,8 @@ namespace sprout { } public: template - SPROUT_CONSTEXPR clone_type operator()(Args const&... args) const { - return make(sprout::make_clone(args...)); + SPROUT_CONSTEXPR clone_type operator()(Args&&... args) const { + return make(sprout::make_clone(sprout::forward(args)...)); } }; @@ -523,22 +540,9 @@ namespace sprout { typedef typename sprout::fixed_container_traits >::clone_type clone_type; typedef typename sprout::fixed_container_traits >::internal_type internal_type; private: - template - clone_type remake( - Other& other, - typename sprout::fixed_container_traits >::difference_type size, - typename sprout::fixed_container_traits::clone_type const& cloned - ) const - { - return clone_type( - cloned, - sprout::next(sprout::begin(cloned), sprout::fixed_begin_offset(other)), - sprout::next(sprout::begin(cloned), sprout::fixed_begin_offset(other) + size) - ); - } template SPROUT_CONSTEXPR clone_type remake( - Other const& other, + Other&& other, typename sprout::fixed_container_traits >::difference_type size, typename sprout::fixed_container_traits::clone_type const& cloned ) const @@ -550,23 +554,18 @@ namespace sprout { ); } public: - template - clone_type operator()( - Other& other, - typename sprout::fixed_container_traits >::difference_type size, - Args const&... args - ) const - { - return remake(other, size, sprout::make_clone(args...)); - } template SPROUT_CONSTEXPR clone_type operator()( - Other const& other, + Other&& other, typename sprout::fixed_container_traits >::difference_type size, - Args const&... args + Args&&... args ) const { - return remake(other, size, sprout::make_clone(args...)); + return remake( + sprout::forward(other), + size, + sprout::make_clone(sprout::forward(args)...) + ); } };