All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Pages
components_join.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
15 #ifndef PAAL_COMPONENTS_JOIN_HPP
16 #define PAAL_COMPONENTS_JOIN_HPP
17 
19 
20 namespace paal {
21 namespace data_structures {
22 
23 namespace detail {
24 
25  // assumes that names with defaults are already at the end of
26  // concatenation of Components1 and Components2
27  template <typename Components1, typename Components2>
28  struct concat;
29 
30  template <typename... ComponentNamesWithDefaults1, typename... ComponentNamesWithDefaults2>
31  struct concat<
32  paal::data_structures::components<ComponentNamesWithDefaults1...>,
33  paal::data_structures::components<ComponentNamesWithDefaults2...>
34  > {
35  using type = paal::data_structures::components<ComponentNamesWithDefaults1..., ComponentNamesWithDefaults2...>;
36  };
37 
38 }
39 
48 template <typename Components1, typename Components2>
49 struct join;
50 
60 template <typename Name1, typename Default1, typename... ComponentNamesWithDefaults1>
61 struct join<components<NameWithDefault<Name1, Default1>, ComponentNamesWithDefaults1...>, components<>> {
62  using type = components<NameWithDefault<Name1, Default1>, ComponentNamesWithDefaults1...>;
63 };
64 
75 template <typename Name1, typename Default1, typename... ComponentNamesWithDefaults1,
76  typename Name2, typename Default2, typename... ComponentNamesWithDefaults2>
77 struct join<components<NameWithDefault<Name1, Default1>, ComponentNamesWithDefaults1...>,
78 components<NameWithDefault<Name2, Default2>, ComponentNamesWithDefaults2...>> {
79  using type = components<
81  ComponentNamesWithDefaults1...,
83  ComponentNamesWithDefaults2...
84  >;
85 };
86 
96 template <typename Name1, typename Default1, typename... ComponentNamesWithDefaults1,
97  typename ComponentName2, typename... ComponentNamesWithDefaults2>
98 struct join<components<NameWithDefault<Name1, Default1>, ComponentNamesWithDefaults1...>,
99 components<ComponentName2, ComponentNamesWithDefaults2...>> {
100  using type = typename detail::concat<
102  typename join<
103  components<NameWithDefault<Name1, Default1>, ComponentNamesWithDefaults1...>,
104  components<ComponentNamesWithDefaults2...>
105  >::type
106  >::type;
107 };
108 
114 template <typename... ComponentNamesWithDefaults2>
115 struct join<components<>, components<ComponentNamesWithDefaults2...>> {
116  using type = components<ComponentNamesWithDefaults2...>;
117 };
118 
126 template <
127  typename ComponentName1,
128  typename... ComponentNamesWithDefaults1,
129  typename... ComponentNamesWithDefaults2
130 >
131 struct join<
132  components<ComponentName1, ComponentNamesWithDefaults1...>,
133  components<ComponentNamesWithDefaults2...>
134 > {
135  using type = typename detail::concat<
137  typename join<components<ComponentNamesWithDefaults1...>, components<ComponentNamesWithDefaults2...>>::type
138  >::type;
139 };
140 
141 }
142 }
143 
144 #endif /* PAAL_COMPONENTS_JOIN_HPP */
This structure can be passed on Names list and represents Name and the default type value...
Definition: components.hpp:33