NiHu  2.0
sequence.hpp
Go to the documentation of this file.
1 // This file is a part of NiHu, a C++ BEM template library.
2 //
3 // Copyright (C) 2012-2014 Peter Fiala <fiala@hit.bme.hu>
4 // Copyright (C) 2012-2014 Peter Rucz <rucz@hit.bme.hu>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
24 #ifndef SEQUENCE_HPP_INCLUDED
25 #define SEQUENCE_HPP_INCLUDED
26 
27 namespace tmp
28 {
29 namespace internal
30 {
31 template <class tag>
32 struct empty_impl;
33 
34 template <class tag>
35 struct size_impl;
36 
37 template <class tag>
38 struct at_impl;
39 
40 template <class tag>
41 struct begin_impl;
42 
43 template <class tag>
44 struct end_impl;
45 
46 template <class tag>
47 struct clear_impl;
48 
49 template <class tag>
50 struct push_front_impl;
51 
52 template <class tag>
53 struct push_back_impl;
54 
55 template <class tag>
56 struct pop_front_impl;
57 
58 template <class tag>
59 struct pop_back_impl;
60 }
61 
63 template <class Seq>
64 struct empty :
65  internal::empty_impl<typename Seq::tag> {};
66 
68 template <class Seq>
69 struct size :
70  internal::size_impl<typename Seq::tag>::template apply<Seq> {};
71 
73 template <class Seq, class Pos>
74 struct at :
75  internal::at_impl<typename Seq::tag>::template apply<Seq, Pos> {};
76 
78 template <class Seq>
79 struct begin :
80  internal::begin_impl<typename Seq::tag>::template apply<Seq> {};
81 
83 template <class Seq>
84 struct end :
85  internal::end_impl<typename Seq::tag>::template apply<Seq> {};
86 
88 template <class Seq>
89 struct clear :
90  internal::clear_impl<typename Seq::tag>::template apply<Seq> {};
91 
93 template <class Seq, class T>
94 struct push_front :
95  internal::push_front_impl<typename Seq::tag>::template apply<Seq, T> {};
96 
98 template <class Seq, class T>
99 struct push_back :
100  internal::push_back_impl<typename Seq::tag>::template apply<Seq, T> {};
101 
103 template <class Seq>
104 struct pop_front :
105  internal::pop_front_impl<typename Seq::tag>::template apply<Seq> {};
106 
108 template <class Seq>
109 struct pop_back :
110  internal::pop_back_impl<typename Seq::tag>::template apply<Seq> {};
111 
113 template <class Iter>
114 struct deref;
115 
117 template <class State, class Operation>
118 struct inserter
119 {
121  typedef State state;
123  typedef Operation operation;
124 };
125 } // end of namespace tmp
126 
127 #endif /* SEQUENCE_HPP_INCLUDED */
128 
tmp::pop_back
pop an element from the back
Definition: sequence.hpp:109
tmp::push_front
push an element to the front
Definition: sequence.hpp:94
tmp::deref
metafunction to dereference an iterator
Definition: sequence.hpp:114
tmp
template metaprogramming functions
Definition: asymptotic_types.hpp:101
tmp::end
return end iterator of a sequence
Definition: sequence.hpp:84
tmp::pop_front
pop an element from the front
Definition: sequence.hpp:104
tmp::clear
clear a sequence
Definition: sequence.hpp:89
tmp::begin
return begin iterator of a sequence
Definition: sequence.hpp:79
tmp::size
return size
Definition: sequence.hpp:69
tmp::apply
The apply metafunction shortcut for lambda evaluation.
Definition: lambda.hpp:239
tmp::empty
return empty sequence
Definition: sequence.hpp:64
tmp::push_back
push an element to the back
Definition: sequence.hpp:99
tmp::inserter::state
State state
the actual state of the underlying sequence
Definition: sequence.hpp:121
tmp::at
return element at a given position
Definition: sequence.hpp:74
tmp::inserter
a compile time inserter
Definition: sequence.hpp:118
tmp::inserter::operation
Operation operation
the operation performed by insertion
Definition: sequence.hpp:123