• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Created by Jozef on 02/12/2018.
3  *  Copyright 2018 Two Blue Cubes Ltd. All rights reserved.
4  *
5  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
6  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  */
8 
9 #ifndef TWOBLUECUBES_CATCH_META_HPP_INCLUDED
10 #define TWOBLUECUBES_CATCH_META_HPP_INCLUDED
11 
12 #include <type_traits>
13 
14 namespace Catch {
15 template< typename... >
16 struct TypeList {};
17 
18 template< typename... >
19 struct append;
20 
21 template< template<typename...> class L1
22     , typename...E1
23     , template<typename...> class L2
24     , typename...E2
25 >
26 struct append< L1<E1...>, L2<E2...> > {
27     using type = L1<E1..., E2...>;
28 };
29 
30 template< template<typename...> class L1
31     , typename...E1
32     , template<typename...> class L2
33     , typename...E2
34     , typename...Rest
35 >
36 struct append< L1<E1...>, L2<E2...>, Rest...> {
37     using type = typename append< L1<E1..., E2...>, Rest... >::type;
38 };
39 
40 template< template<typename...> class
41     , typename...
42 >
43 struct rewrap;
44 
45 template< template<typename...> class Container
46     , template<typename...> class List
47     , typename...elems
48 >
49 struct rewrap<Container, List<elems...>> {
50     using type = TypeList< Container< elems... > >;
51 };
52 
53 template< template<typename...> class Container
54     , template<typename...> class List
55     , class...Elems
56     , typename...Elements>
57     struct rewrap<Container, List<Elems...>, Elements...> {
58     using type = typename append<TypeList<Container<Elems...>>, typename rewrap<Container, Elements...>::type>::type;
59 };
60 
61 template< template<typename...> class...Containers >
62 struct combine {
63     template< typename...Types >
64     struct with_types {
65         template< template <typename...> class Final >
66         struct into {
67             using type = typename append<Final<>, typename rewrap<Containers, Types...>::type...>::type;
68         };
69     };
70 };
71 
72 template<typename T>
73 struct always_false : std::false_type {};
74 
75 } // namespace Catch
76 
77 #endif // TWOBLUECUBES_CATCH_META_HPP_INCLUDED
78