24#ifndef MORPHEUS_CONTAINERFACTORY_IMPL_HPP
25#define MORPHEUS_CONTAINERFACTORY_IMPL_HPP
27#include <Morpheus_Metaprogramming.hpp>
34template <
typename T1,
typename T2>
35struct BinaryContainer;
36template <
typename ContainerType,
typename TypeSet>
41template <
typename ContainerType,
typename TypeSet>
42struct UnaryContainerProxy;
44template <
typename Container,
typename T1,
typename T2,
typename T3,
46struct UnaryContainerProxy_Impl;
50template <
template <
class...>
class Container,
typename T,
typename ValueType>
51struct UnaryContainerProxy_Impl<Container<T>, ValueType, Default, Default,
53 using type = Container<ValueType>;
55 using value_type = ValueType;
56 using index_type = Default;
57 using array_layout = Default;
58 using backend = Default;
63template <
template <
class...>
class Container,
typename T,
typename ValueType,
65struct UnaryContainerProxy_Impl<Container<T>, ValueType, IndexType, Default,
67 using type = Container<ValueType, IndexType>;
69 using value_type = ValueType;
70 using index_type = IndexType;
71 using array_layout = Default;
72 using backend = Default;
77template <
template <
class...>
class Container,
typename T,
typename ValueType,
79struct UnaryContainerProxy_Impl<Container<T>, ValueType, Default, Layout,
81 using type = Container<ValueType, Layout>;
83 using value_type = ValueType;
84 using index_type = Default;
85 using array_layout = Layout;
86 using backend = Default;
91template <
template <
class...>
class Container,
typename T,
typename ValueType,
93struct UnaryContainerProxy_Impl<Container<T>, ValueType, Default, Default,
95 using type = Container<ValueType, Space>;
97 using value_type = ValueType;
98 using index_type = Default;
99 using array_layout = Default;
100 using backend = Space;
105template <
template <
class...>
class Container,
typename T,
typename ValueType,
106 typename IndexType,
typename Layout>
107struct UnaryContainerProxy_Impl<Container<T>, ValueType, IndexType, Layout,
109 using type = Container<ValueType, IndexType, Layout>;
111 using value_type = ValueType;
112 using index_type = IndexType;
113 using array_layout = Layout;
114 using backend = Default;
119template <
template <
class...>
class Container,
typename T,
typename ValueType,
120 typename IndexType,
typename Space>
121struct UnaryContainerProxy_Impl<Container<T>, ValueType, IndexType, Default,
123 using type = Container<ValueType, IndexType, Space>;
125 using value_type = ValueType;
126 using index_type = IndexType;
127 using array_layout = Default;
128 using backend = Space;
133template <
template <
class...>
class Container,
typename T,
typename ValueType,
134 typename Layout,
typename Space>
135struct UnaryContainerProxy_Impl<Container<T>, ValueType, Default, Layout,
137 using type = Container<ValueType, Layout, Space>;
139 using value_type = ValueType;
140 using index_type = Default;
141 using array_layout = Layout;
142 using backend = Space;
147template <
template <
class...>
class Container,
typename T,
typename ValueType,
148 typename IndexType,
typename Layout,
typename Space>
149struct UnaryContainerProxy_Impl<Container<T>, ValueType, IndexType, Layout,
151 using type = Container<ValueType, IndexType, Layout, Space>;
153 using value_type = ValueType;
154 using index_type = IndexType;
155 using array_layout = Layout;
156 using backend = Space;
160template <
template <
class...>
class Container,
typename T,
typename T1,
161 typename T2,
typename T3,
typename T4>
162struct UnaryContainerProxy<Container<T>, Set<T1, T2, T3, T4>> {
163 using unary = UnaryContainerProxy_Impl<Container<T>, T1, T2, T3, T4>;
164 using type =
typename unary::type;
166 using value_type =
typename unary::value_type;
167 using index_type =
typename unary::index_type;
168 using array_layout =
typename unary::array_layout;
169 using backend =
typename unary::backend;
172template <
typename... Ts>
173struct generate_unary_typelist {};
177struct generate_unary_typelist<TypeList<>, T> {
178 using type = TypeList<>;
182struct generate_unary_typelist<T, TypeList<>> {
183 using type = TypeList<>;
187template <
template <
typename...>
class Container,
typename T,
typename... U>
188struct generate_unary_typelist<Container<T>, Set<U...>> {
189 using type = UnaryContainer<Container<T>, Set<U...>>;
193template <
template <
typename...>
class Container,
typename T,
typename... U,
195struct generate_unary_typelist<Container<T>, TypeList<Set<U...>, Us...>> {
196 using type =
typename concat<
197 TypeList<typename generate_unary_typelist<Container<T>, Set<U...>>::type>,
198 typename generate_unary_typelist<Container<T>,
199 TypeList<Us...>>::type>::type;
202template <
typename... Ts>
203struct generate_binary_typelist {};
206template <
typename T1,
typename T2>
207struct generate_binary_typelist<Set<T1, T2>> {
208 using type = TypeList<BinaryContainer<T1, T2>>;
213struct generate_binary_typelist<TypeList<S>> {
214 using type =
typename Impl::generate_binary_typelist<S>::type;
218template <
typename S,
typename... Ss>
219struct generate_binary_typelist<TypeList<S, Ss...>> {
220 using type =
typename concat<
221 typename Impl::generate_binary_typelist<S>::type,
222 typename Impl::generate_binary_typelist<TypeList<Ss...>>::type>::type;
225template <
typename... Lists>
226struct generate_binary_typelist_proxy {};
229template <
typename... List1,
typename... List2>
230struct generate_binary_typelist_proxy<TypeList<List1...>, TypeList<List2...>> {
232 typename Impl::generate_binary_typelist<
typename Morpheus::cross_product<
233 TypeList<List1...>, TypeList<List2...>>::type>::type;
Generic Morpheus interfaces.
Definition: dummy.cpp:24