tinympl  0.2
mini MPL library for C++11
reverse.hpp
1 // Copyright (C) 2013, Ennio Barbaro.
2 //
3 // Use, modification, and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://sbabbi.github.io/tinympl for documentation.
8 //
9 // You are welcome to contact the author at:
10 // enniobarbaro@gmail.com
11 //
12 
13 #ifndef TINYMPL_VARIADIC_REVERSE_HPP
14 #define TINYMPL_VARIADIC_REVERSE_HPP
15 
16 namespace tinympl {
17 namespace variadic {
18 
30 template<template<class ...> class Out, class ... Args> struct reverse;
31 
32 template<template<class ...> class Out, class Head, class ... Tail>
33 struct reverse<Out, Head, Tail...> {
34 private:
35  template<class ... ReversedTail>
36  struct impl {
37  typedef typename reverse<Out, Tail...>::template
38  impl<Head, ReversedTail...>::type type;
39  };
40 
41  template<template<class ...> class, class ...> friend struct reverse;
42 
43 public:
44  typedef typename impl<>::type type;
45 };
46 
47 template<template<class ...> class Out> struct reverse<Out> {
48 private:
49  template<class ... ReversedTail>
50  struct impl {
51  typedef Out<ReversedTail...> type;
52  };
53 
54  template<template<class ...> class, class ...> friend struct reverse;
55 
56 public:
57  typedef Out<> type;
58 };
59 
60 } // namespace variadic
61 } // namespace tinympl
62 
63 #endif // TINYMPL_VARIADIC_REVERSE_HPP
Reverse the input sequence.
Definition: reverse.hpp:35
Reverse the input sequence.
Definition: reverse.hpp:30