Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-09-19 03:15:54


Guillaume Melquiond wrote:

> > > >- ar.register_type<bus_stop_corner>();
> > > >- ar.register_type<bus_stop_destination>();
> > > >+ ar.template register_type<bus_stop_corner>();
> > > >+ ar.template register_type<bus_stop_destination>();
> > >
> > > gosh - I've never seen that syntax before.
> > > I don't even know what it means.
> >
> > This means: "consider register_type to be name of template"

[...]

> > I was not able to test with online comeau, since it seems to fail on
> > everything, with no error messages. Further, I have failed to find the
> > relevant text in the standard. The syntax I've used is allowed by the
> > grammar, but I think there is some text about it as well.

> This syntax is not only allowed by the grammar, it is obligatory:
> 14.2-4
> "When the name of a member template specialization appears after . or ->
> in a postfix expression, of after nested-name-specifier in a qualified-id,
> and the postfix-expression or qualified-id depends on a template parameter
> (14.6.2), the member template must be prefixed by the keyword template.
> Otherwise the name is assumed to name a non-template."

Thanks for the pointer. I've missed this this part myself -- mostly looked at
14.6 (name resolution).

- Volodya


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