Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-06-03 15:21:20


Here's what I think we should do with the iterator adaptor
named parameters.

Instead of the nested templates scheme, I think we should have the user
specify the name using a wrapper class for each parameter. The wrapper
class names would correspond to the parameter name, with something like
"_p" at the end to mean "parameter" and to avoid name clashes. The usage
would look like this:

boost::iterator_adaptor<Iter, Policy,
  boost::reference_p<T&>, boost::value_type_p<T> >

The normal non-named parameter usage would still be supported of course.

The implementation creates a type-list out of the parameter wrappers that
basically acts like an associative list, with the key being a tag class
that identifies the parameter, and the value being the argument type. When
an argument is passed in without a wrapper, this is detected and the
wrapper is added before inserting into the type-list. Then there's some
meta-code that searches through the type-list for each parameter, and then
resolve any defaults.

I just finished implementing this approach, seems to work pretty well and
is a bit simpler than the previous approach, and of course avoid the
problem of the "template" keyword showing up all over the place.

Does this sound like an acceptable solution?

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate, IU B'ton email: jsiek_at_[hidden]
 Summer Manager, AT&T Research phone: (973) 360-8185
----------------------------------------------------------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk