1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

add container_range_traits default

This commit is contained in:
bolero-MURAKAMI 2016-04-18 00:34:15 +09:00
parent 0080332dd5
commit 8efb1a3748
23 changed files with 1822 additions and 1384 deletions

View file

@ -24,9 +24,6 @@
#include <sprout/tpp/algorithm/all_of.hpp>
namespace sprout {
//
// container_construct_traits
//
namespace detail {
template<typename Container, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
@ -85,37 +82,35 @@ namespace sprout {
)
);
}
template<typename Container>
struct container_construct_traits_impl {
public:
typedef Container copied_type;
public:
template<typename Cont>
static SPROUT_CONSTEXPR copied_type
deep_copy(Cont&& cont) {
return SPROUT_FORWARD(Cont, cont);
}
template<typename... Args>
static SPROUT_CONSTEXPR copied_type
make(Args&&... args) {
return sprout::detail::default_make_container<Container>(SPROUT_FORWARD(Args, args)...);
}
template<typename Cont, typename... Args>
static SPROUT_CONSTEXPR copied_type
remake(Cont&& cont, typename sprout::container_traits<Container>::difference_type size, Args&&... args) {
return sprout::detail::default_remake_container<Container>(
SPROUT_FORWARD(Cont, cont), size,
SPROUT_FORWARD(Args, args)...
);
}
};
} // namespace detail
//
// container_construct_traits
//
template<typename Container>
struct container_construct_traits
: public sprout::detail::container_construct_traits_impl<Container>
{};
struct container_construct_traits {
public:
typedef Container copied_type;
public:
template<typename Cont>
static SPROUT_CONSTEXPR copied_type
deep_copy(Cont&& cont) {
return SPROUT_FORWARD(Cont, cont);
}
template<typename... Args>
static SPROUT_CONSTEXPR copied_type
make(Args&&... args) {
return sprout::detail::default_make_container<Container>(SPROUT_FORWARD(Args, args)...);
}
template<typename Cont, typename... Args>
static SPROUT_CONSTEXPR copied_type
remake(Cont&& cont, typename sprout::container_traits<Container>::difference_type size, Args&&... args) {
return sprout::detail::default_remake_container<Container>(
SPROUT_FORWARD(Cont, cont), size,
SPROUT_FORWARD(Args, args)...
);
}
};
template<typename Container>
struct container_construct_traits<Container const>
: public sprout::container_construct_traits<Container>