![]() |
Oven provides range-based algorithms taking a range instead of two iterators.
algorithm.hpp is provided as range-based <algorithm>.
<pstade/oven/algorithm.hpp>|
Valid expression |
Semantics |
|---|---|
|
|
|
|
|
|
|
|
|
f1 and f2
is one of the function names defined in <algorithm>
except for...
fill_n, generate_n, rotate,
rotate_copy, partial_sort, nth_element
and inplace_merge.
f3 is one of the following
names...
rotate, rotate_copy, partial_sort,
nth_element and inplace_merge.
std::f1(_begin(_rng), _end(_rng), x1,...,xN) is a valid exression.
std::f2(_begin(_rng1), _end(_rng1), _begin(_rng2), _end(_rng2), x1,...,xN) is a valid expression.
std::f3(_begin(_rng), m, _end(_rng), x1,...,xN) is a valid expression.
_fun(_rng)
is a valid expression.
_typeof(_fun(_rng))
is _iter_of<_typeof(_rng)>::type.
![]() |
Note |
|---|---|
|
|
std::string str; // iterator-based str = "gfedcba"; std::sort(str.begin(), str.end()); BOOST_CHECK( str == "abcdefg" ); // Oven range-based str = "gfedcba"; sort(str); BOOST_CHECK( str == "abcdefg" );
numeric.hpp is provided as range-based <numeric>.
<pstade/oven/numeric.hpp>|
Valid expression |
Semantics |
|---|---|
|
|
|
f is one of the function
names defined in <numeric>.
std::f(_begin(_rng), _end(_rng), x1,...,xN) is a valid expression.
![]() |
Important |
|---|---|
|
Unfortunately, Oven STL Algorithms and Numerics are not traversal-aware.
A Random
Access Range
whose
|
at returns the N-th referent
from the beginning of the range.
<pstade/oven/at.hpp>|
Valid expression |
Semantics |
|---|---|
|
|
|
![]() |
Note |
|---|---|
|
you must use value_at if the second precondition can't be met.
|
std::string str("f12344513215b"); BOOST_CHECK( at(str, 0) == 'f' ); BOOST_CHECK( (str|at(4)) == '4' );
back returns the last referent
in the range.
<pstade/oven/back.hpp>|
Valid expression |
Semantics |
|---|---|
|
|
|
front returns the first referent
in the range.
<pstade/oven/front.hpp>|
Valid expression |
Semantics |
|---|---|
|
|
|
begin and end
is Ambi
Static
Function Object which represents boost::begin
and boost::end respectively.
<pstade/oven/begin_end.hpp>|
Valid expression |
Semantics |
|---|---|
|
|
|
|
|
|
std::string src("abcDefg"); copy(src|reversed|upper_chars, src|reversed|begin); BOOST_CHECK( equals(src, std::string("ABCDEFG")) );
copied automagically calls
the range-constructor of the target range without specifying the type.
<pstade/oven/copied.hpp>V1 is _value_of<_typeof(_rng1)>::type.
to_v1 is regular(boost::lambda::ll_static_cast<V1>(boost::lambda::_1)).
|
Valid expression |
Semantics |
|---|---|
|
|
|
|
|
|
_rng1 is a Sequence.
X_ such
that boost::is_convertible<X_, Rng1>::value == false.
_value_of<_typeof(_rng)>::type is convertible to V1.
Rng2 is an aggregate
type such that Rng2
_rng2 =
_rng0|copied;
is a valid expression.
copied isn't placed in
a function default argument list.
![]() |
Note |
|---|---|
|
The first valid expression implies you can place
|
std::string rng("abcdefg"); std::vector<char> vec = rng|copied; BOOST_CHECK( equals(vec, rng) );
distance is a range-based
std::distance but traversal-aware.
<pstade/oven/distance.hpp>|
Valid expression |
Semantics |
|---|---|
|
|
|
std::distance(_begin(_rng), _end(_rng))
is a valid expression.
equals is a range-based
std::equal but sensitive to the distances.
<pstade/oven/equals.hpp>eq is (boost::lambda::_1 == boost::lambda::_2).
|
Valid expression |
Semantics |
|---|---|
|
|
|
|
|
|
exists returns true if a
predicate is true for a referent in the range.
<pstade/oven/exists.hpp>|
Valid expression |
Semantics |
|---|---|
|
|
|
forall returns true if a
predicate is true for all the referents in the range.
<pstade/oven/forall.hpp>not_ is an imaginary function
to nagate a predicate.
|
Valid expression |
Semantics |
|---|---|
|
|
|
value_at returns a copy of
N-th referent from the beginning of the range.
<pstade/oven/at.hpp>V is _value_of<_typeof(_rndrng)>::type.
|
Valid expression |
Semantics |
|---|---|
|
|
|
_rndrng is Readable.
_typeof(n) is
convertible to boost::range_difference<_typeof(_rndrng)>::type.
0 <=
n &&
n <
distance(_rndrng)
value_back returns a copy
of the last referent in the range.
<pstade/oven/back.hpp>V is _value_of<_typeof(_bidrng)>::type.
|
Valid expression |
Semantics |
|---|---|
|
|
|
_bidrng is Readable.
!boost::empty(_bidrng)
value_front returns a copy
of the first referent in the range.
<pstade/oven/front.hpp>V is _value_of<_typeof(_rng)>::type.
|
Valid expression |
Semantics |
|---|---|
|
|
|
_rng is Readable.
!boost::empty(_rng)| Copyright © 2005 -2007 Shunsuke Sogame |