From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-03-04 08:55:43
Jeremy Siek wrote:
> Another variation on the named template parameters.
> Instead of using :: to separate the parameters, we stick with the more
> traditional comma. This requires some "type wrapper" classes,
> each with a
> name corresponding to the template parameter.
> boost::iterator_adaptor<int*, default_iterator_policies,
> Category<std::input_iterator_tag>, Reference<int>
That's pretty nice. However, IMO there is one disadvantage here - users of
the library will have either to prefix parameters' names with (at least)
'boost::', so it becomes a little bit clumsy:
or to write something like 'using boost::Category', 'using boost::Reference'
etc. I don't really like both alternatives.. The former one effectively
reserves the common parameters' names in 'boost' namespace for the iterator
adaptors library, and thus prevents other boost libraries from adopting them
(and, consequently, the technique) in their contexts; it can be fixed by
putting names into nested namespace (boost::iterators::Category), or making
them less generic (boost::IteratorCategory), but that also makes things more
clumsy. The latter approach (using declarations) is, IMO, applicable only if
in user code there is (or there might be created) a well-defined scoped
(namespace) in which the names' prefix(es) can be safely "peeled off". IMO
often it's not the case (e.g. user code might not create it's own
namespaces, and if it can/does, requirement to do so to simplify library
usage seems to be overkill).
Just my opinion, though :)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk