fixed_container_traits 仕様変更

This commit is contained in:
bolero-MURAKAMI 2011-10-30 17:40:35 +09:00
parent 9a229b824f
commit 2168f05433
43 changed files with 174 additions and 202 deletions

View file

@ -27,7 +27,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
@ -66,7 +66,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename... Args> template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -27,7 +27,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes < offset && Indexes + size >= static_cast<std::size_t>(offset) && Indexes + input_size >= static_cast<std::size_t>(offset) (Indexes < offset && Indexes + size >= static_cast<std::size_t>(offset) && Indexes + input_size >= static_cast<std::size_t>(offset)
@ -66,7 +66,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename BidirectionalIterator, typename Result, typename... Args> template<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -25,7 +25,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename Predicate, typename... Args> template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -36,7 +36,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Size, typename Result, typename... Args> template<typename InputIterator, typename Size, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -21,7 +21,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Container>::size_type size typename sprout::fixed_container_traits<Container>::size_type size
) )
{ {
return sprout::remake_clone<Container, Container>( return sprout::remake_clone<Container>(
cont, cont,
sprout::size(cont), sprout::size(cont),
(Indexes >= offset && Indexes < offset + size (Indexes >= offset && Indexes < offset + size

View file

@ -99,7 +99,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Container, Container>(cont, sprout::size(cont), args...); return sprout::remake_clone<Container>(cont, sprout::size(cont), args...);
} }
template<std::size_t InitSize, typename Container, typename Generator, typename... Args> template<std::size_t InitSize, typename Container, typename Generator, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -28,7 +28,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args> template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -25,7 +25,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename Predicate, typename... Args> template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -25,7 +25,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename T, typename... Args> template<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -25,7 +25,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename Predicate, typename... Args> template<typename InputIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -30,7 +30,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
@ -75,7 +75,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename T, typename... Args> template<typename InputIterator, typename Result, typename T, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -29,7 +29,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
@ -74,7 +74,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename T, typename Predicate, typename... Args> template<typename InputIterator, typename Result, typename T, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -27,7 +27,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
@ -66,7 +66,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename BidirectionalIterator, typename Result, typename... Args> template<typename BidirectionalIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -28,7 +28,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
@ -72,7 +72,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename ForwardIterator, typename Result, typename... Args> template<typename ForwardIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -105,7 +105,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename ForwardIterator, typename Result, typename... Args> template<typename ForwardIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -28,7 +28,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args> template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -28,7 +28,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args> template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -28,7 +28,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args> template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -28,7 +28,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args> template<typename InputIterator1, typename InputIterator2, typename Result, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -63,7 +63,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Container>::size_type size typename sprout::fixed_container_traits<Container>::size_type size
) )
{ {
return sprout::remake_clone<Container, Container>( return sprout::remake_clone<Container>(
cont, cont,
sprout::size(cont), sprout::size(cont),
(Indexes >= offset && Indexes < offset + size (Indexes >= offset && Indexes < offset + size

View file

@ -25,7 +25,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename BidirectionalIterator, typename Result, typename Predicate, typename... Args> template<typename BidirectionalIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -62,7 +62,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename BidirectionalIterator, typename Result, typename Predicate, typename... Args> template<typename BidirectionalIterator, typename Result, typename Predicate, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -35,7 +35,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Container, Container>(cont, sprout::size(cont), args...); return sprout::remake_clone<Container>(cont, sprout::size(cont), args...);
} }
template<typename Container, typename Compare, typename... Args> template<typename Container, typename Compare, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -29,7 +29,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
@ -78,7 +78,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename... Args> template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -28,7 +28,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
@ -70,7 +70,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename UnaryOperation, typename... Args> template<typename InputIterator, typename Result, typename UnaryOperation, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -131,7 +131,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Result>::size_type input_size typename sprout::fixed_container_traits<Result>::size_type input_size
) )
{ {
return sprout::remake_clone<Result, Result>( return sprout::remake_clone<Result>(
result, result,
sprout::size(result), sprout::size(result),
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
@ -176,7 +176,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator1, typename InputIterator2, typename Result, typename BinaryOperation, typename... Args> template<typename InputIterator1, typename InputIterator2, typename Result, typename BinaryOperation, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -25,7 +25,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args..., head); return sprout::remake_clone<Result>(result, sprout::size(result), args..., head);
} }
template<typename InputIterator, typename Result, typename Head, typename... Args> template<typename InputIterator, typename Result, typename Head, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -79,7 +79,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args..., head); return sprout::remake_clone<Result>(result, sprout::size(result), args..., head);
} }
template<typename InputIterator, typename Result, typename BinaryPredicate, typename Head, typename... Args> template<typename InputIterator, typename Result, typename BinaryPredicate, typename Head, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -19,7 +19,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename... Args> template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -42,7 +42,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename... Args> template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -68,7 +68,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename... Args> template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -19,7 +19,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename... Args> template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -42,7 +42,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename... Args> template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -68,7 +68,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename... Args> template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -1,28 +1,21 @@
#ifndef SPROUT_FIXED_CONTAINER_CLONE_HPP #ifndef SPROUT_FIXED_CONTAINER_CLONE_HPP
#define SPROUT_FIXED_CONTAINER_CLONE_HPP #define SPROUT_FIXED_CONTAINER_CLONE_HPP
#include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/fixed_container/traits.hpp> #include <sprout/fixed_container/traits.hpp>
#include <sprout/utility/forward.hpp>
namespace sprout { namespace sprout {
// //
// clone // clone
// //
template<typename Container> template<typename Container>
inline typename sprout::fixed_container_traits<Container>::clone_type clone(Container& cont) { SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<
return sprout::clone_functor<Container>().template operator()(cont); typename std::remove_reference<Container>::type
} >::clone_type clone(Container&& cont) {
template<typename Container, typename... Args> typedef typename std::decay<Container>::type container_type;
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::clone_type clone(Container const& cont) { return sprout::clone_functor<container_type>().template operator()(sprout::forward<Container>(cont));
return sprout::clone_functor<Container>().template operator()(cont);
}
//
// cclone
//
template<typename Container>
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::clone_type cclone(Container const& cont) {
return sprout::clone_functor<Container>().template operator()(cont);
} }
} // namespace sprout } // namespace sprout

View file

@ -22,7 +22,7 @@ namespace sprout {
// //
template<typename Container> template<typename Container>
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type const& get_cfixed(Container const& cont) { SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type const& get_cfixed(Container const& cont) {
return sprout::get_fixed_functor<Container>()(cont); return sprout::get_fixed_functor<Container>().template operator()(cont);
} }
// //
@ -30,7 +30,7 @@ namespace sprout {
// //
template<typename Container> template<typename Container>
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type get_fixed_copy(Container const& cont) { SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type get_fixed_copy(Container const& cont) {
return sprout::get_fixed_functor<Container>()(cont); return sprout::get_fixed_functor<Container>().template operator()(cont);
} }
} // namespace sprout } // namespace sprout

View file

@ -1,16 +1,21 @@
#ifndef SPROUT_FIXED_CONTAINER_MAKE_CLONE_HPP #ifndef SPROUT_FIXED_CONTAINER_MAKE_CLONE_HPP
#define SPROUT_FIXED_CONTAINER_MAKE_CLONE_HPP #define SPROUT_FIXED_CONTAINER_MAKE_CLONE_HPP
#include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/fixed_container/traits.hpp> #include <sprout/fixed_container/traits.hpp>
#include <sprout/utility/forward.hpp>
namespace sprout { namespace sprout {
// //
// make_clone // make_clone
// //
template<typename Container, typename... Args> template<typename Container, typename... Args>
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::clone_type make_clone(Args const&... args) { SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<
return sprout::make_clone_functor<Container>().template operator()(args...); typename std::remove_reference<Container>::type
>::clone_type make_clone(Args&&... args) {
typedef typename std::remove_reference<Container>::type container_type;
return sprout::make_clone_functor<container_type>().template operator()(sprout::forward<Args>(args)...);
} }
} // namespace sprout } // namespace sprout

View file

@ -1,43 +1,30 @@
#ifndef SPROUT_FIXED_CONTAINER_REMAKE_CLONE_HPP #ifndef SPROUT_FIXED_CONTAINER_REMAKE_CLONE_HPP
#define SPROUT_FIXED_CONTAINER_REMAKE_CLONE_HPP #define SPROUT_FIXED_CONTAINER_REMAKE_CLONE_HPP
#include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/fixed_container/traits.hpp> #include <sprout/fixed_container/traits.hpp>
#include <sprout/utility/forward.hpp>
namespace sprout { namespace sprout {
// //
// remake_clone // remake_clone
// //
template<typename Container, typename Other, typename... Args> template<typename Container, typename Other, typename... Args>
inline typename sprout::fixed_container_traits<Container>::clone_type remake_clone( SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<
Other& other, typename std::remove_reference<Container>::type
>::clone_type remake_clone(
Other&& other,
typename sprout::fixed_container_traits<Container>::difference_type size, typename sprout::fixed_container_traits<Container>::difference_type size,
Args const&... args Args&&... args
) )
{ {
return sprout::remake_clone_functor<Container>().template operator()(other, size, args...); typedef typename std::remove_reference<Container>::type container_type;
} return sprout::remake_clone_functor<container_type>().template operator()(
template<typename Container, typename Other, typename... Args> sprout::forward<Other>(other),
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::clone_type remake_clone( size,
Other const& other, sprout::forward<Args>(args)...
typename sprout::fixed_container_traits<Container>::difference_type size, );
Args const&... args
)
{
return sprout::remake_clone_functor<Container>().template operator()(other, size, args...);
}
//
// remake_cclone
//
template<typename Container, typename Other, typename... Args>
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::clone_type remake_cclone(
Other const& other,
typename sprout::fixed_container_traits<Container>::difference_type size,
Args const&... args
)
{
return sprout::remake_clone_functor<Container>().template operator()(other, size, args...);
} }
} // namespace sprout } // namespace sprout

View file

@ -5,6 +5,7 @@
#include <array> #include <array>
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
namespace sprout { namespace sprout {
namespace detail { namespace detail {
@ -114,6 +115,10 @@ namespace sprout {
return cont; return cont;
} }
}; };
template<typename Container>
struct get_fixed_functor<Container const>
: public sprout::get_fixed_functor<Container>
{};
// //
// clone_functor // clone_functor
@ -121,13 +126,15 @@ namespace sprout {
template<typename Container> template<typename Container>
struct clone_functor { struct clone_functor {
public: public:
typename sprout::fixed_container_traits<Container>::clone_type operator()(Container& cont) const { template<typename Other>
return typename sprout::fixed_container_traits<Container>::clone_type(cont); SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::clone_type operator()(Other&& cont) const {
} return typename sprout::fixed_container_traits<Container>::clone_type(sprout::forward<Other>(cont));
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::clone_type operator()(Container const& cont) const {
return typename sprout::fixed_container_traits<Container>::clone_type(cont);
} }
}; };
template<typename Container>
struct clone_functor<Container const>
: public sprout::clone_functor<Container>
{};
// //
// make_clone_functor // make_clone_functor
@ -136,10 +143,14 @@ namespace sprout {
struct make_clone_functor { struct make_clone_functor {
public: public:
template<typename... Args> template<typename... Args>
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::clone_type operator()(Args const&... args) const { SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::clone_type operator()(Args&&... args) const {
return typename sprout::fixed_container_traits<Container>::clone_type{{args...}}; return typename sprout::fixed_container_traits<Container>::clone_type{{sprout::forward<Args>(args)...}};
} }
}; };
template<typename Container>
struct make_clone_functor<Container const>
: public sprout::make_clone_functor<Container>
{};
// //
// remake_clone_functor // remake_clone_functor
@ -147,25 +158,20 @@ namespace sprout {
template<typename Container> template<typename Container>
struct remake_clone_functor { struct remake_clone_functor {
public: public:
template<typename Other, typename... Args>
typename sprout::fixed_container_traits<Container>::clone_type operator()(
Other& other,
typename sprout::fixed_container_traits<Container>::difference_type size,
Args const&... args
) const
{
return sprout::make_clone_functor<Container>().template operator()(args...);
}
template<typename Other, typename... Args> template<typename Other, typename... Args>
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::clone_type operator()( SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::clone_type operator()(
Other const& other, Other&& other,
typename sprout::fixed_container_traits<Container>::difference_type size, typename sprout::fixed_container_traits<Container>::difference_type size,
Args const&... args Args&&... args
) const ) const
{ {
return sprout::make_clone_functor<Container>().template operator()(args...); return sprout::make_clone_functor<Container>().template operator()(sprout::forward<Args>(args)...);
} }
}; };
template<typename Container>
struct remake_clone_functor<Container const>
: public sprout::remake_clone_functor<Container>
{};
} // namespace sprout } // namespace sprout
#endif // #ifndef SPROUT_FIXED_CONTAINER_TRAITS_HPP #endif // #ifndef SPROUT_FIXED_CONTAINER_TRAITS_HPP

View file

@ -20,7 +20,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename... Args> template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -46,7 +46,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename... Args> template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -78,7 +78,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename... Args> template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -132,7 +132,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename BinaryOperation, typename... Args> template<typename Result, typename BinaryOperation, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -159,7 +159,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename BinaryOperation, typename... Args> template<typename InputIterator, typename Result, typename BinaryOperation, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -193,7 +193,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename BinaryOperation, typename... Args> template<typename InputIterator, typename Result, typename BinaryOperation, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -21,7 +21,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Container>::size_type size typename sprout::fixed_container_traits<Container>::size_type size
) )
{ {
return sprout::remake_clone<Container, Container>( return sprout::remake_clone<Container>(
cont, cont,
sprout::size(cont), sprout::size(cont),
(Indexes >= offset && Indexes < offset + size (Indexes >= offset && Indexes < offset + size

View file

@ -20,7 +20,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename... Args> template<typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -46,7 +46,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename... Args> template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -78,7 +78,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename... Args> template<typename InputIterator, typename Result, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -132,7 +132,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename Result, typename BinaryOperation, typename... Args> template<typename Result, typename BinaryOperation, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -159,7 +159,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename BinaryOperation, typename... Args> template<typename InputIterator, typename Result, typename BinaryOperation, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<
@ -193,7 +193,7 @@ namespace sprout {
Args const&... args Args const&... args
) )
{ {
return sprout::remake_clone<Result, Result>(result, sprout::size(result), args...); return sprout::remake_clone<Result>(result, sprout::size(result), args...);
} }
template<typename InputIterator, typename Result, typename BinaryOperation, typename... Args> template<typename InputIterator, typename Result, typename BinaryOperation, typename... Args>
SPROUT_CONSTEXPR inline typename std::enable_if< SPROUT_CONSTEXPR inline typename std::enable_if<

View file

@ -36,7 +36,7 @@ namespace sprout {
Input const& input Input const& input
) )
{ {
return sprout::remake_clone<Result, Container>( return sprout::remake_clone<Result>(
cont, cont,
sprout::size(cont) + sprout::size(input), sprout::size(cont) + sprout::size(input),
(Indexes < sprout::fixed_container_traits<Container>::fixed_size + size (Indexes < sprout::fixed_container_traits<Container>::fixed_size + size

View file

@ -35,7 +35,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Container>::difference_type pos typename sprout::fixed_container_traits<Container>::difference_type pos
) )
{ {
return sprout::remake_clone<Result, Container>( return sprout::remake_clone<Result>(
cont, cont,
sprout::size(cont) - 1, sprout::size(cont) - 1,
(Indexes < sprout::fixed_container_traits<Container>::fixed_size - 1 (Indexes < sprout::fixed_container_traits<Container>::fixed_size - 1

View file

@ -35,7 +35,7 @@ namespace sprout {
typename sprout::fixed_container_traits<Container>::difference_type pos typename sprout::fixed_container_traits<Container>::difference_type pos
) )
{ {
return sprout::remake_clone<Result, Container>( return sprout::remake_clone<Result>(
cont, cont,
sprout::size(cont) - N, sprout::size(cont) - N,
(Indexes < sprout::fixed_container_traits<Container>::fixed_size - N (Indexes < sprout::fixed_container_traits<Container>::fixed_size - N

View file

@ -38,7 +38,7 @@ namespace sprout {
Values const&... values Values const&... values
) )
{ {
return sprout::remake_clone<Result, Container>( return sprout::remake_clone<Result>(
cont, cont,
sprout::size(cont) + 1 + sizeof...(Values), sprout::size(cont) + 1 + sizeof...(Values),
(Indexes < sprout::fixed_container_traits<Container>::fixed_size + 1 + sizeof...(Values) (Indexes < sprout::fixed_container_traits<Container>::fixed_size + 1 + sizeof...(Values)

View file

@ -39,7 +39,7 @@ namespace sprout {
Values const&... values Values const&... values
) )
{ {
return sprout::remake_clone<Result, Container>( return sprout::remake_clone<Result>(
cont, cont,
sprout::size(cont) + (1 + sizeof...(Values)) * N, sprout::size(cont) + (1 + sizeof...(Values)) * N,
(Indexes < sprout::fixed_container_traits<Container>::fixed_size + (1 + sizeof...(Values)) * N (Indexes < sprout::fixed_container_traits<Container>::fixed_size + (1 + sizeof...(Values)) * N

View file

@ -31,7 +31,7 @@ namespace sprout {
T const& v T const& v
) )
{ {
return sprout::remake_clone<Result, Container>( return sprout::remake_clone<Result>(
cont, cont,
sprout::size(cont), sprout::size(cont),
(Indexes != pos (Indexes != pos

View file

@ -9,6 +9,7 @@
#include <sprout/fixed_container/functions.hpp> #include <sprout/fixed_container/functions.hpp>
#include <sprout/iterator.hpp> #include <sprout/iterator.hpp>
#include <sprout/iterator/value_iterator.hpp> #include <sprout/iterator/value_iterator.hpp>
#include <sprout/utility/forward.hpp>
namespace sprout { namespace sprout {
// //
@ -216,10 +217,8 @@ namespace sprout {
private: private:
typedef typename sprout::fixed_container_traits<sprout::pit<Container> >::clone_type clone_type; typedef typename sprout::fixed_container_traits<sprout::pit<Container> >::clone_type clone_type;
public: public:
clone_type operator()(sprout::pit<Container>& cont) const { template<typename Other>
return clone_type(); SPROUT_CONSTEXPR clone_type operator()(Other&& cont) const {
}
SPROUT_CONSTEXPR clone_type operator()(sprout::pit<Container> const& cont) const {
return clone_type(); return clone_type();
} }
}; };
@ -234,8 +233,8 @@ namespace sprout {
typedef typename sprout::fixed_container_traits<sprout::pit<Container> >::internal_type internal_type; typedef typename sprout::fixed_container_traits<sprout::pit<Container> >::internal_type internal_type;
public: public:
template<typename... Args> template<typename... Args>
SPROUT_CONSTEXPR clone_type operator()(Args const&... args) const { SPROUT_CONSTEXPR clone_type operator()(Args&&... args) const {
return sprout::make_clone<internal_type>(args...); return sprout::make_clone<internal_type>(sprout::forward<Args>(args)...);
} }
}; };
@ -248,23 +247,14 @@ namespace sprout {
typedef typename sprout::fixed_container_traits<sprout::pit<Container> >::clone_type clone_type; typedef typename sprout::fixed_container_traits<sprout::pit<Container> >::clone_type clone_type;
typedef typename sprout::fixed_container_traits<sprout::pit<Container> >::internal_type internal_type; typedef typename sprout::fixed_container_traits<sprout::pit<Container> >::internal_type internal_type;
public: public:
template<typename Other, typename... Args>
clone_type operator()(
Other& other,
typename sprout::fixed_container_traits<sprout::pit<Container> >::difference_type size,
Args const&... args
) const
{
return sprout::remake_clone<internal_type, Other>(other, size, args...);
}
template<typename Other, typename... Args> template<typename Other, typename... Args>
SPROUT_CONSTEXPR clone_type operator()( SPROUT_CONSTEXPR clone_type operator()(
Other const& other, Other&& other,
typename sprout::fixed_container_traits<sprout::pit<Container> >::difference_type size, typename sprout::fixed_container_traits<sprout::pit<Container> >::difference_type size,
Args const&... args Args&&... args
) const ) const
{ {
return sprout::remake_clone<internal_type, Other>(other, size, args...); return sprout::remake_clone<internal_type>(sprout::forward<Other>(other), size, sprout::forward<Args>(args)...);
} }
}; };
} // namespace sprout } // namespace sprout

View file

@ -16,6 +16,7 @@
#include <sprout/operation/fixed/append_back.hpp> #include <sprout/operation/fixed/append_back.hpp>
#include <sprout/operation/fixed/append_front.hpp> #include <sprout/operation/fixed/append_front.hpp>
#include <sprout/iterator.hpp> #include <sprout/iterator.hpp>
#include <sprout/utility/forward.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
# include <algorithm> # include <algorithm>
@ -746,31 +747,31 @@ namespace sprout {
static SPROUT_CONSTEXPR clone_type make_impl(typename clone_type::size_type size) { static SPROUT_CONSTEXPR clone_type make_impl(typename clone_type::size_type size) {
return clone_type{{}, size}; return clone_type{{}, size};
} }
template<std::size_t S, typename... Args> template<std::size_t S, typename Head, typename... Tail>
static SPROUT_CONSTEXPR typename std::enable_if< static SPROUT_CONSTEXPR typename std::enable_if<
S != sizeof...(Args), S == sizeof...(Tail),
clone_type clone_type
>::type make_impl(typename clone_type::size_type size, T const& head, Args const&... tail) { >::type make_impl(typename clone_type::size_type size, Head&& head, Tail&&... tail) {
return make_impl<S + 1>(size, tail..., S < size ? head : T()); return clone_type{{sprout::forward<Tail>(tail)..., sprout::forward<Head>(head)}, size};
} }
template<std::size_t S, typename... Args> template<std::size_t S, typename Head, typename... Tail>
static SPROUT_CONSTEXPR typename std::enable_if< static SPROUT_CONSTEXPR typename std::enable_if<
S == sizeof...(Args), S != sizeof...(Tail),
clone_type clone_type
>::type make_impl(typename clone_type::size_type size, T const& head, Args const&... tail) { >::type make_impl(typename clone_type::size_type size, Head&& head, Tail&&... tail) {
return clone_type{{tail..., head}, size}; return make_impl<S + 1>(size, sprout::forward<Tail>(tail)..., S >= size ? T() : sprout::forward<Head>(head));
} }
public: public:
static SPROUT_CONSTEXPR typename clone_type::size_type length() { static SPROUT_CONSTEXPR typename clone_type::size_type length() {
return 0; return 0;
} }
template<typename... Tail> template<typename... Tail>
static SPROUT_CONSTEXPR typename clone_type::size_type length(T const& head, Tail const&... tail) { static SPROUT_CONSTEXPR typename clone_type::size_type length(T const& head, Tail&&... tail) {
return !head ? 0 : 1 + length(tail...); return !head ? 0 : 1 + length(sprout::forward<Tail>(tail)...);
} }
template<typename... Args> template<typename... Args>
static SPROUT_CONSTEXPR clone_type make(typename clone_type::size_type size, Args const&... args) { static SPROUT_CONSTEXPR clone_type make(typename clone_type::size_type size, Args&&... args) {
return make_impl<0>(size, args...); return make_impl<0>(size, sprout::forward<Args>(args)...);
} }
}; };
} // namespace detail } // namespace detail
@ -785,8 +786,8 @@ namespace sprout {
typedef sprout::detail::make_clone_functor_impl<container_type> impl_type; typedef sprout::detail::make_clone_functor_impl<container_type> impl_type;
public: public:
template<typename... Args> template<typename... Args>
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<container_type>::clone_type operator()(Args const&... args) const { SPROUT_CONSTEXPR typename sprout::fixed_container_traits<container_type>::clone_type operator()(Args&&... args) const {
return impl_type::make(impl_type::length(args...), args...); return impl_type::make(impl_type::length(sprout::forward<Args>(args)...), sprout::forward<Args>(args)...);
} }
}; };
@ -801,21 +802,12 @@ namespace sprout {
public: public:
template<typename Other, typename... Args> template<typename Other, typename... Args>
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<container_type>::clone_type operator()( SPROUT_CONSTEXPR typename sprout::fixed_container_traits<container_type>::clone_type operator()(
Other& other, Other&& other,
typename sprout::fixed_container_traits<container_type>::difference_type size, typename sprout::fixed_container_traits<container_type>::difference_type size,
Args const&... args Args&&... args
) const ) const
{ {
return impl_type::make(size, args...); return impl_type::make(size, sprout::forward<Args>(args)...);
}
template<typename Other, typename... Args>
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<container_type>::clone_type operator()(
Other const& other,
typename sprout::fixed_container_traits<container_type>::difference_type size,
Args const&... args
) const
{
return impl_type::make(size, args...);
} }
}; };

View file

@ -10,6 +10,7 @@
#include <sprout/fixed_container/traits.hpp> #include <sprout/fixed_container/traits.hpp>
#include <sprout/fixed_container/functions.hpp> #include <sprout/fixed_container/functions.hpp>
#include <sprout/iterator/operation.hpp> #include <sprout/iterator/operation.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/detail/if.hpp> #include <sprout/detail/if.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
@ -486,12 +487,28 @@ namespace sprout {
struct clone_functor<sprout::sub_array<Container> > { struct clone_functor<sprout::sub_array<Container> > {
private: private:
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::clone_type clone_type; typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::clone_type clone_type;
public: private:
clone_type operator()(sprout::sub_array<Container>& cont) const { template<typename Other>
return clone_type(sprout::clone(sprout::get_fixed(cont)), sprout::fixed_begin_offset(cont), sprout::fixed_end_offset(cont)); SPROUT_CONSTEXPR clone_type make(
Other&& cont,
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type first,
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type last
) const
{
return clone_type(
sprout::clone(sprout::get_fixed(sprout::forward<Other>(cont))),
first,
last
);
} }
SPROUT_CONSTEXPR clone_type operator()(sprout::sub_array<Container> const& cont) const { public:
return clone_type(sprout::clone(sprout::get_fixed(cont)), sprout::fixed_begin_offset(cont), sprout::fixed_end_offset(cont)); template<typename Other>
SPROUT_CONSTEXPR clone_type operator()(Other&& cont) const {
return make(
sprout::forward<Other>(cont),
sprout::fixed_begin_offset(cont),
sprout::fixed_end_offset(cont)
);
} }
}; };
@ -509,8 +526,8 @@ namespace sprout {
} }
public: public:
template<typename... Args> template<typename... Args>
SPROUT_CONSTEXPR clone_type operator()(Args const&... args) const { SPROUT_CONSTEXPR clone_type operator()(Args&&... args) const {
return make(sprout::make_clone<internal_type>(args...)); return make(sprout::make_clone<internal_type>(sprout::forward<Args>(args)...));
} }
}; };
@ -523,22 +540,9 @@ namespace sprout {
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::clone_type clone_type; typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::clone_type clone_type;
typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::internal_type internal_type; typedef typename sprout::fixed_container_traits<sprout::sub_array<Container> >::internal_type internal_type;
private: private:
template<typename Other>
clone_type remake(
Other& other,
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type size,
typename sprout::fixed_container_traits<internal_type>::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<typename Other> template<typename Other>
SPROUT_CONSTEXPR clone_type remake( SPROUT_CONSTEXPR clone_type remake(
Other const& other, Other&& other,
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type size, typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type size,
typename sprout::fixed_container_traits<internal_type>::clone_type const& cloned typename sprout::fixed_container_traits<internal_type>::clone_type const& cloned
) const ) const
@ -550,23 +554,18 @@ namespace sprout {
); );
} }
public: public:
template<typename Other, typename... Args>
clone_type operator()(
Other& other,
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type size,
Args const&... args
) const
{
return remake(other, size, sprout::make_clone<internal_type>(args...));
}
template<typename Other, typename... Args> template<typename Other, typename... Args>
SPROUT_CONSTEXPR clone_type operator()( SPROUT_CONSTEXPR clone_type operator()(
Other const& other, Other&& other,
typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type size, typename sprout::fixed_container_traits<sprout::sub_array<Container> >::difference_type size,
Args const&... args Args&&... args
) const ) const
{ {
return remake(other, size, sprout::make_clone<internal_type>(args...)); return remake(
sprout::forward<Other>(other),
size,
sprout::make_clone<internal_type>(sprout::forward<Args>(args)...)
);
} }
}; };