Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-01-30 14:29:18


>From: "Gennaro Prota" <gennaro_prota_at_[hidden]>

> On Thu, 30 Jan 2003 12:20:32 -0000, "John Maddock"
> <jm_at_[hidden]> wrote:
>
> >> Can you show, with an example, why the code used for named template
> >> arguments can't reasonably use an expression?
> >
> >It doesn't have access to one, only a type: the usage is take some
template
> >parameter, see if it is convertible to some policy type, and if it is,
then
> >extract the policy information.
>
> The technique I know relies on detecting whether the template argument
> is *derived* from some policy, and that's doable with expressions.

You don't need expressions (if by that you mean an object of the type to
test, or pointer/reference to it) to check for convertibility, as it may be
done with sizeof, so no object of any kind need to be created. However, you
may need an object, or pointer/reference to it, to use function templates.
Also, that won't make it a compile-time expression, so why use function
templates for this?

Regards,

Terje


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