Oven provides some useful Output Iterators.
any_output_iterator
is an
Output Iterator
to which any Output
Iterator can be assigned.
<pstade/oven/any_output_iterator.hpp>
Valid expression |
Semantics |
---|---|
|
An Output
Iterator whose iterator operations are forwarded to |
V
specifies a (possibly
reference) type which is outputted to _outit
.
int const in[] = { 1,2,3,4,5,6,7,8,9,10 }; int const answer[] = {2*3,4*3,6*3,8*3,10*3}; std::vector<int> out; any_output_iterator<int> o1, o2; o1 = filterer(regular(bll::_1 % 2 == 0)) |= std::back_inserter(out); o2 = transformer(regular(bll::_1 * 3)) |= o1; copy(in, o2); BOOST_CHECK( equals(out, answer) );
applier
returns an Output Iterator
which passes each item assigned as an argument to the unary function.
<pstade/oven/applier.hpp>
Valid expression |
Semantics |
---|---|
|
|
T
is boost::function_output_iterator<typeof(_fun)>
such that T(_fun)
is a valid expression.
_fun
is Assignable.
eater
returns an Output
Iterator which ignores inputs.
<pstade/oven/eater.hpp>
f_
is an imaginary Function Object
which behaves as if it were v
-> (void)v
.
Valid expression |
Semantics |
---|---|
|
|
stream_writer
returns an
Output Iterator
which is a shorthand version of std::ostream_iterator
.
It needs no explicit template parameter to specify the value_type
to output, but one extra precondition below must be met. It can be easily
guaranteed by using converter
,
though.
<pstade/oven/stream_writer.hpp>
Valid expression |
Semantics |
---|---|
|
|
|
|
Note | |
---|---|
|
T
is hamigaki::ostream_iterator<unspecified, _typeof(s)::char_type,
_typeof(s)::traits_type>
such that T(s, d)
is a valid expressin.
_typeof(stream_writer(s))::operator=
is Output
Streamable.
std::vector<std::string> sample = initial_values("hello", "oven", "stream_writer"); { std::ofstream fout("read.txt"); copy(sample, stream_writer(fout, " ")); } { std::ifstream fin("read.txt"); BOOST_CHECK( equals( oven::stream_read<std::string>(fin), sample ) ); }
streambuf_writer
is the object
generator of std::ostreambuf_iterator
.
<pstade/oven/stream_writer.hpp>
Valid expression |
Semantics |
---|---|
|
|
|
|
T
is std::ostreambuf_iterator<typeof(s)::char_type,
typeof(s)::traits_type>
such that T(s)
is
a valid expression.
U
is std::ostreambuf_iterator<typeof(*p)::char_type,
typeof(*p)::traits_type>
such that U(p)
is
a valid expression.
std_stream_writer
returns
an Output Iterator
which behaves as if it were std::ostream_iterator
.
<pstade/oven/stream_writer.hpp>
Valid expression |
Semantics |
---|---|
|
|
|
|
Note | |
---|---|
|
Copyright © 2005 -2007 Shunsuke Sogame |