Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-05-23 12:17:16


I am having two sets of problems with the Named Template Parameter feature
which was added to the Iterator Adaptors library:

---
First, a question: is anyone out there using this feature successfully?
---
1. When I try to use it, GCC chokes on whatever the last parameter in my
3-parameter chain is. It complains (incorrectly) that I'm passing a non-type
parameter where the template expects a type.
2. When I forgot to supply a Distance parameter for my iterator adaptor
wrapping a non-iterator Base type, I got other errors which I had lots of
trouble diagnosing. The code for handling the named template parameters is
so complicated and without substantial comments that it's hard to understand
what's going on.
Finally, these remarks:
It looks like the code we have in iterator_adaptor_test.cpp for testing the
named template parameter technique is inadequate, since it only tests one
case where no default parameter values are used. It didn't reveal the
problem I'm having with GCC. Given this and the complexity of the code I am
tempted to roll back the feature until more people than just Jeremy can
understand it.
When using the named template parameter approach in a template, it could get
a bit unweildy because instead of writing e.g., ::value_type<T> you need to
write ::template value_type<T>. I think our documentation should make
mention of this and we should consider whether there are ways to cut down
the syntax.
-Dave

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