|
1 | 1 | #ifndef MPL14_FUNCTIONAL_COMPOSE_HPP_INCLUDED
|
2 | 2 | #define MPL14_FUNCTIONAL_COMPOSE_HPP_INCLUDED
|
3 | 3 |
|
4 |
| -#include "../fundamental/identity.hpp" |
| 4 | +#include "placeholder.hpp" |
5 | 5 |
|
6 |
| -#include "../control/if.hpp" |
7 |
| - |
8 |
| -#include "../tuple/tuple_element.hpp" |
9 |
| -#include "../tuple/push_back.hpp" |
10 |
| -#include "../tuple/push_front.hpp" |
11 |
| -#include "../tuple/make_tuple.hpp" |
12 |
| -#include "../tuple/apply.hpp" |
| 6 | +#include "../fundamental/integral.hpp" |
13 | 7 |
|
14 |
| -#include "../algorithm/merge.hpp" |
15 |
| -#include "../algorithm/count.hpp" |
| 8 | +#include "../control/if.hpp" |
| 9 | +#include "../control/bind.hpp" |
16 | 10 |
|
17 | 11 | #include <tuple>
|
18 | 12 |
|
19 | 13 | namespace mplex {
|
20 |
| - |
| 14 | + template <typename T> |
| 15 | + struct is_compound_expression; |
| 16 | + |
| 17 | + template <typename Functor, typename... Params> |
| 18 | + struct compose_impl { |
| 19 | + using type = Functor; |
| 20 | + using params = std::tuple <Params>; |
| 21 | + |
| 22 | + template <typename... Parameters> |
| 23 | + struct apply { |
| 24 | + using type = Functor < |
| 25 | + lazy_if_t <is_compound_expression<Parameters>::type, |
| 26 | + then_ < |
| 27 | + > |
| 28 | + }; |
| 29 | + }; |
| 30 | + |
| 31 | + |
| 32 | + struct is_compound_expression { |
| 33 | + template <typename T> |
| 34 | + struct apply { |
| 35 | + constexpr static const bool value = false; |
| 36 | + using type = bool_<false>; |
| 37 | + }; |
| 38 | + } |
| 39 | + |
| 40 | + template <typename... List> |
| 41 | + struct is_compound_expression::apply <compose <List...> > { |
| 42 | + constexpr static const bool value = true; |
| 43 | + using type = bool_<true>; |
| 44 | + }; |
21 | 45 | }
|
22 | 46 |
|
23 | 47 | #endif // MPL14_FUNCTIONAL_COMPOSE_HPP_INCLUDED
|
0 commit comments