mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-12 14:54:10 +00:00
add complex tuple and container support
This commit is contained in:
parent
f4d715c6db
commit
54920b3389
11 changed files with 357 additions and 100 deletions
44
sprout/complex/container.hpp
Normal file
44
sprout/complex/container.hpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*=============================================================================
|
||||
Copyright (c) 2011-2014 Bolero MURAKAMI
|
||||
https://github.com/bolero-MURAKAMI/Sprout
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#ifndef SPROUT_COMPLEX_CONTAINER_HPP
|
||||
#define SPROUT_COMPLEX_CONTAINER_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/complex/complex.hpp>
|
||||
#include <sprout/container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// container_construct_traits
|
||||
//
|
||||
template<typename T>
|
||||
struct container_construct_traits<sprout::complex<T> > {
|
||||
public:
|
||||
typedef sprout::complex<T> 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) {
|
||||
typedef sprout::detail::make_construct_impl<copied_type> impl_type;
|
||||
return copied_type(SPROUT_FORWARD(Args, args)...);
|
||||
}
|
||||
template<typename Cont, typename... Args>
|
||||
static SPROUT_CONSTEXPR copied_type
|
||||
remake(Cont&&, typename sprout::container_traits<sprout::complex<T> >::difference_type size, Args&&... args) {
|
||||
return copied_type(SPROUT_FORWARD(Args, args)...);
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_COMPLEX_CONTAINER_HPP
|
Loading…
Add table
Add a link
Reference in a new issue