Skip to content

Commit dd965ed

Browse files
committed
[WIP] Advanced bind = compose.
1 parent 7d62821 commit dd965ed

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

functional/compose.hpp

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,47 @@
11
#ifndef MPL14_FUNCTIONAL_COMPOSE_HPP_INCLUDED
22
#define MPL14_FUNCTIONAL_COMPOSE_HPP_INCLUDED
33

4-
#include "../fundamental/identity.hpp"
4+
#include "placeholder.hpp"
55

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"
137

14-
#include "../algorithm/merge.hpp"
15-
#include "../algorithm/count.hpp"
8+
#include "../control/if.hpp"
9+
#include "../control/bind.hpp"
1610

1711
#include <tuple>
1812

1913
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+
};
2145
}
2246

2347
#endif // MPL14_FUNCTIONAL_COMPOSE_HPP_INCLUDED

0 commit comments

Comments
 (0)