mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-12 14:54:10 +00:00
fix support for STL container: some algorithms
This commit is contained in:
parent
ace6acad69
commit
a9cd556f8e
28 changed files with 911 additions and 106 deletions
|
@ -8,30 +8,72 @@
|
|||
#include <sprout/container/functions.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace detail {
|
||||
template<typename Container, typename = void>
|
||||
struct pit_container_construct_traits;
|
||||
|
||||
template<typename Container>
|
||||
struct pit_container_construct_traits<
|
||||
sprout::pit<Container>,
|
||||
typename std::enable_if<sprout::is_fixed_container<Container>::value>::type
|
||||
> {
|
||||
public:
|
||||
typedef typename sprout::container_construct_traits<Container>::copied_type copied_type;
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
deep_copy(Cont&& cont) {
|
||||
return copied_type();
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
make(Args&&... args) {
|
||||
return sprout::make<copied_type>(sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake(Cont&& cont, typename sprout::container_traits<sprout::pit<Container> >::difference_type size, Args&&... args) {
|
||||
return sprout::remake<copied_type>(sprout::forward<Cont>(cont), size, sprout::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Container>
|
||||
struct pit_container_construct_traits<
|
||||
sprout::pit<Container>,
|
||||
typename std::enable_if<!sprout::is_fixed_container<Container>::value>::type
|
||||
> {
|
||||
public:
|
||||
typedef typename sprout::container_construct_traits<Container>::copied_type copied_type;
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
deep_copy(Cont&& cont) {
|
||||
return copied_type();
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
make(Args&&... args) {
|
||||
return sprout::make<copied_type>(sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake(Cont&& cont, typename sprout::container_traits<sprout::pit<Container> >::difference_type size, Args&&... args) {
|
||||
return sprout::remake<copied_type>(sprout::forward<Cont>(cont), size, sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename InputIterator>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake(Cont&& cont, typename sprout::container_traits<sprout::pit<Container> >::difference_type size, InputIterator first, InputIterator last) {
|
||||
return copied_type(first, last);
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
//
|
||||
// container_construct_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct container_construct_traits<sprout::pit<Container> > {
|
||||
public:
|
||||
typedef typename sprout::container_construct_traits<Container>::copied_type copied_type;
|
||||
public:
|
||||
template<typename Cont>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
deep_copy(Cont&& cont) {
|
||||
return copied_type();
|
||||
}
|
||||
template<typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
make(Args&&... args) {
|
||||
return sprout::make<copied_type>(sprout::forward<Args>(args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake(Cont&& cont, typename sprout::container_traits<sprout::pit<Container> >::difference_type size, Args&&... args) {
|
||||
return sprout::remake<copied_type>(sprout::forward<Cont>(cont), size, sprout::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
struct container_construct_traits<sprout::pit<Container> >
|
||||
: public sprout::detail::pit_container_construct_traits<sprout::pit<Container> >
|
||||
{};
|
||||
|
||||
//
|
||||
// container_transform_traits
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue