mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add sprout/range/adaptor/deep_copied.hpp
fix sprout/range/adaptor/sized.hpp
This commit is contained in:
parent
bcd7674cc0
commit
955561e36c
10 changed files with 178 additions and 15 deletions
|
@ -2,6 +2,7 @@
|
|||
#define SPROUT_CONTAINER_CONTAINER_TRANSFORM_TRAITS_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/container/container_traits.hpp>
|
||||
|
||||
|
@ -13,9 +14,33 @@ namespace sprout {
|
|||
struct container_transform_traits;
|
||||
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
struct is_like_array_class
|
||||
: public std::false_type
|
||||
{};
|
||||
template<
|
||||
template<typename, std::size_t> class Array,
|
||||
typename T,
|
||||
std::size_t N
|
||||
>
|
||||
struct is_like_array_class<Array<T, N> >
|
||||
: public std::true_type
|
||||
{};
|
||||
template<typename Container>
|
||||
struct is_like_array_class<Container const>
|
||||
: public sprout::detail::is_like_array_class<Container>
|
||||
{};
|
||||
template<typename Container>
|
||||
struct is_like_array_class<Container volatile>
|
||||
: public sprout::detail::is_like_array_class<Container>
|
||||
{};
|
||||
template<typename Container>
|
||||
struct is_like_array_class<Container const volatile>
|
||||
: public sprout::detail::is_like_array_class<Container>
|
||||
{};
|
||||
|
||||
template<typename Container, typename sprout::container_traits<Container>::size_type Size>
|
||||
struct default_array_rebind_size;
|
||||
|
||||
template<
|
||||
template<typename, std::size_t> class Array,
|
||||
typename T,
|
||||
|
@ -26,16 +51,26 @@ namespace sprout {
|
|||
public:
|
||||
typedef Array<T, Size> type;
|
||||
};
|
||||
|
||||
template<typename Container, typename = void>
|
||||
struct inherit_default_rebind_size {};
|
||||
template<typename Container>
|
||||
struct inherit_default_rebind_size<
|
||||
Container,
|
||||
typename std::enable_if<sprout::detail::is_like_array_class<Container>::value>::type
|
||||
> {
|
||||
public:
|
||||
template<typename sprout::container_traits<Container>::size_type Size>
|
||||
struct rebind_size
|
||||
: public sprout::detail::default_array_rebind_size<Container, Size>
|
||||
{};
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template<typename Container>
|
||||
struct container_transform_traits {
|
||||
public:
|
||||
template<typename sprout::container_traits<Container>::size_type Size>
|
||||
struct rebind_size
|
||||
: public sprout::detail::default_array_rebind_size<Container, Size>
|
||||
{};
|
||||
};
|
||||
struct container_transform_traits
|
||||
: public sprout::detail::inherit_default_rebind_size<Container>
|
||||
{};
|
||||
template<typename Container>
|
||||
struct container_transform_traits<Container const> {
|
||||
public:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue