summaryrefslogtreecommitdiff
path: root/src/bindings/cxx/eldbus_cxx/eldbus_integer_sequence.hh
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-23 12:01:30 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-05-23 15:05:50 -0300
commite3c8b280c639058c54f5576f189d0dc288105fc7 (patch)
treee313fa05bd9d2b2cb88623f6adea2c3b396b66e8 /src/bindings/cxx/eldbus_cxx/eldbus_integer_sequence.hh
parent930f39b91b12b311f40cd96b4cf2e85085b01832 (diff)
c++: Reorganized C++ binding generation
Moved all generation to a single Makefile_Cxx.am file instead of throughout the whole project. And fixed C++ generation on Elementary after elm merge.
Diffstat (limited to 'src/bindings/cxx/eldbus_cxx/eldbus_integer_sequence.hh')
-rw-r--r--src/bindings/cxx/eldbus_cxx/eldbus_integer_sequence.hh41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/bindings/cxx/eldbus_cxx/eldbus_integer_sequence.hh b/src/bindings/cxx/eldbus_cxx/eldbus_integer_sequence.hh
new file mode 100644
index 0000000000..282936a91a
--- /dev/null
+++ b/src/bindings/cxx/eldbus_cxx/eldbus_integer_sequence.hh
@@ -0,0 +1,41 @@
1#ifndef ELDBUS_CXX_ELDBUS_INTEGER_SEQUENCE_HH
2#define ELDBUS_CXX_ELDBUS_INTEGER_SEQUENCE_HH
3
4namespace efl { namespace eldbus { namespace _detail {
5
6template <typename T, T... Ints>
7struct integer_sequence
8{
9 typedef T value_type;
10 static constexpr std::size_t size() { return sizeof...(Ints); }
11 typedef integer_sequence<T, Ints...> type;
12};
13
14template<class S1, class S2> struct concat;
15
16template<typename T, T... I1, T... I2>
17struct concat<integer_sequence<T, I1...>, integer_sequence<T, I2...> >
18 : integer_sequence<T, I1..., (sizeof...(I1)+I2)...> {};
19
20template<class S1, class S2>
21using Concat = typename concat<S1, S2>::type;
22
23template<typename T, T N> struct gen_seq;
24template<typename T, T N> using make_integer_sequence = typename gen_seq<T, N>::type;
25
26template<typename T, T N>
27struct gen_seq : Concat<make_integer_sequence<T, N/2>
28 , make_integer_sequence<T, N - N/2>>{};
29
30template<> struct gen_seq<std::size_t, 0> : integer_sequence<std::size_t>{};
31template<> struct gen_seq<std::size_t, 1> : integer_sequence<std::size_t, 0>{};
32
33template <std::size_t... I>
34using index_sequence = integer_sequence<std::size_t, I...>;
35
36template <std::size_t I>
37using make_index_sequence = make_integer_sequence<std::size_t, I>;
38
39} } }
40
41#endif