Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
Morpheus_ContainerFactory.hpp
1
24#ifndef MORPHEUS_CONTAINER_FACTORY_HPP
25#define MORPHEUS_CONTAINER_FACTORY_HPP
26
27#include <impl/Morpheus_ContainerFactory_Impl.hpp>
28
29#include <type_traits>
30
31namespace Morpheus {
32
44struct Default {};
59template <class T>
61 typedef char yes[1];
62 typedef char no[2];
63
64 template <class U>
65 static yes& test(
66 U*, typename std::enable_if<std::is_same<U, Default>::value>::type* =
67 nullptr);
68
69 template <class U>
70 static no& test(...);
71
72 public:
73 static const bool value = sizeof(test<T>(nullptr)) == sizeof(yes);
74};
75
81template <typename T>
82inline constexpr bool is_default_v = is_default<T>::value;
124template <typename ContainerType, typename TypeSet>
126 using proxy = typename Impl::UnaryContainerProxy<ContainerType, TypeSet>;
127 using type = typename proxy::type;
128
129 using value_type = typename proxy::value_type;
130 using index_type = typename proxy::index_type;
131 using array_layout = typename proxy::array_layout;
132 using backend = typename proxy::backend;
133};
134
162template <typename ContainerType1, typename ContainerType2>
164 using type1 = ContainerType1;
165 using type2 = ContainerType2;
166};
184template <typename Container, typename U>
186 using type = typename Impl::generate_unary_typelist<Container, U>::type;
187};
188
189// Returns a TypeList<Binary1<>, Binary2<>....>
197template <typename List1, typename List2>
199 using type =
200 typename Impl::generate_binary_typelist_proxy<List1, List2>::type;
201};
205} // namespace Morpheus
206
207#endif // MORPHEUS_CONTAINER_FACTORY_HPP
Checks if the given type T is a Default type.
Definition: Morpheus_ContainerFactory.hpp:60
constexpr bool is_default_v
Short-hand to is_default.
Definition: Morpheus_ContainerFactory.hpp:82
Generic Morpheus interfaces.
Definition: dummy.cpp:24
A wrapper that constructs a new container type that holds two container types.
Definition: Morpheus_ContainerFactory.hpp:163
A Default tag is used to denote the use of default types.
Definition: Morpheus_ContainerFactory.hpp:44
A wrapper that constructs a new container type from ContainerType using as arguments the types in Typ...
Definition: Morpheus_ContainerFactory.hpp:125
Generates a TypeList of all combinations of BinaryContainer from two TypeLists of containers.
Definition: Morpheus_ContainerFactory.hpp:198
Generates a TypeList of UnaryContainer where each container type is generated from each combination o...
Definition: Morpheus_ContainerFactory.hpp:185