Problem with function template specialization

Christian Convey conveycj@npt.nuwc.navy.mil
Mon Jan 3 12:44:00 GMT 2005


Martin York wrote:
>  
> 
> To make it compile do the following:
> 
> 1) Add a new type(alias) that is a pointer to Foo.
> 
> typedef Foo* FooP;
> 
> 2) Change your specialisation to use this new Type (and remove const
> from the specialisation <>)
> 
> template <> 
> string toString<FooP>(const FooP& p) {
>                 ^^^^
> NB. No const in here

Thanks. Can you explain the principal that applies here?  I'm normally 
accustomed to being able to use a type's definition (Foo*) interchangeably with 
its name (FooP).

-- 
Christian Convey
Computer Scientist,
Naval Undersea Warfare Center
Newport, RI



More information about the Gcc-help mailing list