1 #ifndef DUNE_FEM_IO_STREAMS_TUPLES_HH 2 #define DUNE_FEM_IO_STREAMS_TUPLES_HH 4 #include <dune/common/tuples.hh> 5 #include <dune/common/tupleutility.hh> 15 template<
class InStream >
18 struct InStreamFunctor
20 InStreamFunctor ( InStream &in ) : in_( in ) {}
23 void visit ( T &t )
const 33 template<
class Tuple >
34 static InStream &apply ( InStream &in, Tuple &tuple )
36 Dune::ForEachValue< Tuple > forEach( tuple );
37 InStreamFunctor functor( in );
38 forEach.apply( functor );
48 template<
class OutStream >
49 class TupleToOutStream
51 struct OutStreamFunctor
53 OutStreamFunctor ( OutStream &out ) : out_( out ) {}
56 void visit ( T &t )
const 66 template<
class Tuple >
67 static OutStream &apply ( OutStream &out,
const Tuple &tuple )
69 Dune::ForEachValue< Tuple > forEach( const_cast< Tuple & >( tuple ) );
70 OutStreamFunctor functor( out );
71 forEach.apply( functor );
89 template <
class StreamTraits>
90 class OutStreamInterface;
91 template <
class StreamTraits>
92 class InStreamInterface;
99 template<
class StreamTraits >
100 inline InStreamInterface< StreamTraits > &
106 template<
class StreamTraits,
class... Args >
110 return TupleToInStream< InStreamInterface< StreamTraits > >::template apply< std::tuple< Args... > >( in, tuple );
118 template<
class StreamTraits >
120 operator<< ( OutStreamInterface< StreamTraits > &out,
const std::tuple<> &tuple )
125 template<
class StreamTraits,
class... Args >
127 operator<< ( OutStreamInterface< StreamTraits > &out,
const std::tuple< Args... > &tuple )
129 return TupleToOutStream< OutStreamInterface< StreamTraits > >::template apply< std::tuple < Args... > >( out, tuple );
136 #endif // #ifndef DUNE_FEM_IO_STREAMS_TUPLES_HH
InStreamInterface< StreamTraits > & operator>>(InStreamInterface< StreamTraits > &in, std::tuple< Args... > &tuple)
Definition: tuples.hh:108
Definition: coordinate.hh:4
abstract interface for an input stream
Definition: streams.hh:177
abstract interface for an output stream
Definition: streams.hh:44