|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-02-27 16:13:55
I've been playing around with this idea some more. One idea I've had is
instead of using the named parameters for just the traits, use it for
*all* the parameters of iterator_adaptor, wrapping everything in an
iterator_adaptor_generator. Here's how using it would look:
int* x;
boost::iterator_adaptor_generator
::base<int*>
::reference<const int&>
::policies<boost::reverse_iterator_policies>
::end<>::type iter(x);
The end<> deserves some explaining. It's there so that we only instantiate
*one* version of the iterator_adaptor, thus saving the compiler LOTS of
work. One possibility is to add a macro, such as
#define gentype end<>::type
to get rid of the end<> from the user's view. Or if someone can think of
another way to do this, great!
I've attached the implementation for the above... pardon some nasty macro
stuff... not my expertise.
Cheers,
Jeremy
----------------------------------------------------------------------
Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate email: jsiek_at_[hidden]
Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk