Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-06-26 11:07:25


At 11:32 AM 6/26/2001, Jeremy Siek wrote:
>On Tue, 26 Jun 2001, Beman Dawes wrote:
>bdawes>
>bdawes> But in another message someone claimed that template
>bdawes> template parameter replacements were not just broken
>bdawes> compiler workarounds, but actually better that template
>bdawes> template parameters. Could someone explain the rationale
>bdawes> behind that assertion?
>
>Sure. The template template parameter workaround allows more flexibility
>in the template types that are used as parameters. For example, suppose
>the template parameter is a container:

Interesting. Thanks.

Are there counter examples where template template are preferred? Or
should Boost (and other) guidelines be to always use the helper technique
rather than template template parameters?

If there is an expectation that a template parameter's requirements might
be met by specifying general use or open ended sets of classes as the
argument (as in your example), the answer seems clearly to avoid template
template parameters.

But if the example were say a policy class which is normally written
specifically to meet the requirements of a generic class template, then is
the answer still the same? I guess so, in that it might later be found
useful to add an additional defaulted parameter, but you would be blocked
from doing so unless the helper technique had been already used.

By the way, core issue 150 has been declared Not a Defect (NAD) so if I
understand it correctly, the language isn't going to change anytime soon on
this one.

--Beman


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