34 struct TupleAccessTraits
37 typedef T& NonConstType;
42 struct TupleAccessTraits<T*>
45 typedef T* NonConstType;
46 typedef T* ParameterType;
50 struct TupleAccessTraits<T&>
53 typedef T& NonConstType;
54 typedef T& ParameterType;
59 using std::tuple_element;
61 using std::tuple_size;
63 using std::make_tuple;
70 static std::ostream& put(std::ostream& os,
const T& t,
const char* delim=
", ")
72 return tuple_writer<i-1>::put(os,t,delim)<<delim<<Dune::get<i-1>(t);
76 static std::istream &get ( std::istream &is, T &t,
const char *delim =
"," )
78 tuple_writer< i-1 >::get( is, t, delim );
79 for(
const char *it = delim; is && (*it != 0); ++it )
84 is.setstate( std::ios::failbit );
86 return is >> Dune::get< i-1 >( t );
91 struct tuple_writer<1>
94 static std::ostream& put(std::ostream& os,
const T& t,
const char* delim=
", ")
97 return os<<Dune::get<0>(t);
101 static std::istream &get ( std::istream &is, T &t,
const char *delim =
", " )
103 return is >> Dune::get< 0 >( t );
108 struct tuple_writer<0>
111 static std::ostream& put(std::ostream& os,
const T& t,
const char* delim=
", ")
117 static std::istream &get ( std::istream &is, T &t,
const char *delim =
", " )
126 template<
typename T1>
127 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1> & t)
129 typedef tuple<T1> TupleT;
130 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
133 template<
typename T1,
typename T2>
134 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2> & t)
136 typedef tuple<T1,T2> TupleT;
137 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
140 template<
typename T1,
typename T2,
typename T3>
141 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2,T3> & t)
143 typedef tuple<T1,T2,T3> TupleT;
144 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
147 template<
typename T1,
typename T2,
typename T3,
typename T4>
148 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2,T3,T4> & t)
150 typedef tuple<T1,T2,T3,T4> TupleT;
151 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
154 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
155 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2,T3,T4,T5> & t)
157 typedef tuple<T1,T2,T3,T4,T5> TupleT;
158 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
161 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
162 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2,T3,T4,T5,T6> & t)
164 typedef tuple<T1,T2,T3,T4,T5,T6> TupleT;
165 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
168 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
169 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2,T3,T4,T5,T6,T7> & t)
171 typedef tuple<T1,T2,T3,T4,T5,T6,T7> TupleT;
172 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
175 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
177 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2,T3,T4,T5,T6,T7,T8> & t)
179 typedef tuple<T1,T2,T3,T4,T5,T6,T7,T8> TupleT;
180 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
183 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
184 typename T8,
typename T9>
185 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> & t)
187 typedef tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> TupleT;
188 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
191 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
192 typename T8,
typename T9,
typename T10>
193 inline std::ostream&
operator<<( std::ostream& os,
const tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> & t)
195 typedef tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> TupleT;
196 return tuple_writer<tuple_size<TupleT>::value>::put(os, t);
202 template<
typename T1>
203 inline std::istream&
operator>>( std::istream& is, tuple<T1> & t)
205 typedef tuple<T1> TupleT;
206 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
209 template<
typename T1,
typename T2>
210 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2> & t)
212 typedef tuple<T1,T2> TupleT;
213 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
216 template<
typename T1,
typename T2,
typename T3>
217 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2,T3> & t)
219 typedef tuple<T1,T2,T3> TupleT;
220 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
223 template<
typename T1,
typename T2,
typename T3,
typename T4>
224 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2,T3,T4> & t)
226 typedef tuple<T1,T2,T3,T4> TupleT;
227 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
230 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
231 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2,T3,T4,T5> & t)
233 typedef tuple<T1,T2,T3,T4,T5> TupleT;
234 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
237 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
238 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2,T3,T4,T5,T6> & t)
240 typedef tuple<T1,T2,T3,T4,T5,T6> TupleT;
241 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
244 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
245 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2,T3,T4,T5,T6,T7> & t)
247 typedef tuple<T1,T2,T3,T4,T5,T6,T7> TupleT;
248 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
251 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
253 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2,T3,T4,T5,T6,T7,T8> & t)
255 typedef tuple<T1,T2,T3,T4,T5,T6,T7,T8> TupleT;
256 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
259 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
260 typename T8,
typename T9>
261 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> & t)
263 typedef tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> TupleT;
264 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
267 template<
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
268 typename T8,
typename T9,
typename T10>
269 inline std::istream&
operator>>( std::istream& is, tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> & t)
271 typedef tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> TupleT;
272 return tuple_writer<tuple_size<TupleT>::value>::get(is, t);
std::istream & operator>>(std::istream &is, tuple< T1 > &t)
Read a tuple.
Definition: tuples.hh:203
std::ostream & operator<<(std::ostream &s, const array< T, N > &e)
Output operator for array.
Definition: array.hh:26
Dune namespace.
Definition: alignment.hh:10
T UnqualifiedType
The unqualified type.
Definition: typetraits.hh:90
const T ConstType
The const type.
Definition: typetraits.hh:92
Traits for type conversions and type information.
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentional unused function parameters with.
Definition: unused.hh:18