
Graeme Prentice wrote:
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Simon Buchan
Graeme Prentice wrote: <snipped big header>
Six lines is big?
Yep. For a header. Consider how big the headers for a quote nested 3 or 4 levels deep would get. <snip>
You mean: template <class T> void foo( typename bar<T>::baz froble) {...} is fine, but: template <class T> void foo( typename bling::bar<T>::baz froble) {...} isn't? That sounds like a language flaw!
No, neither is fine. bar<T> is a non-deduced context in both cases. What makes you think the first case is fine? There's a good reason for this restriction even though it's a surprise when you first meet it.
Huh. Was I thinking of bar<T> and bar<T>::baz, then? (I have no idea what I was thinking, I wrote that at something like 4AM :D)
(Background info: I would like to use this technique to generate optimized forwarding functions that do not know anything about the function being forwarded to. Overloads taking any number of params would be generated with the boost preprocessor library.)
-Jason
It might be better to write specializations for foo rather
than specify the
types at the point of call.
Graeme
Doesn't that defeat the point of a forwarding function? I agree that it's better than most of the alternatives, though.
How does it defeat the point of a forwarding function?
Do you mean it contradicts the requirement of the forwarding function not knowing anything about the function being forwarded to? If the specializations (or overloads) provided are the same as the call_traits ones, then the forwarding function still doesn't know anything about the function being forwarded to. Chances are the forwarding function will be inlined and the parameter types of the forwarding function won't matter so a single forwarding function that passes by value might do. Using call_traits might even be less efficient.
*shrug*, I guess. I probably don't quite understand what he's trying to do.