Pending section...
Oven emulates a Concept-like extension way for Boost.Range.
<pstade/oven/extension.hpp>
X
is a type extending
Boost.Range.
x
is an object of (possibly
const-qualified) X
.
ER
is ::pstade_oven_extension::Range<X>
.
XS
is a Boost.Preprocessor
Sequence of typename X
.
N
is the number of template
arguments of X
, only valid
if all template arguments are typenames.
S
is a sequence of template
arguments of X
.
X
becomes a model of Range.
ER::associate<X>::mutable_iterator
is the mutable iterator
type of X
.
ER::associate<X>::constant_iterator
is the constant iterator
type of X
.
ER::begin<_iter_of<typeof(x)>::type>(x)
is
a valid expression which returns the begin iterator.
ER::end<_iter_of<typeof(x)>::type>(x)
is
a valid expression which returns the end iterator.
X
is a type, PSTADE_OVEN_EXTENSION_OF_TYPE(X)
is
placed in the global namespace.
X
is a template, PSTADE_OVEN_EXTENSION_OF_TEMPLATE(XS, N)
or
PSTADE_OVEN_EXTENSION_OF_TEMPLATE(XS,
S)
is placed in the global namespace.
namespace Foo { template< class T > struct Pair { T first, last; }; } // namespace Foo namespace pstade_oven_extension { template< class T > struct Range< Foo::Pair<T> > { // X == Foo::Pair<T> template< class X > struct associate { typedef T mutable_iterator; typedef T constant_iterator; }; // if X is not const, Iterator == mutable_iterator; // otherwise, Iterator == constant_iterator. template< class Iterator, class X > Iterator begin(X& x) { return x.first; } template< class Iterator, class X > Iterator end(X& x) { return x.last; } }; } // namespace pstade_oven_extension PSTADE_OVEN_EXTENSION_OF_TEMPLATE((Foo)(Pair), (class)) // PSTADE_OVEN_EXTENSION_OF_TEMPLATE((Foo)(Pair), 1) // also ok.
Copyright © 2005 -2007 Shunsuke Sogame |