Re: Class template specialization with template parameter
  Home FAQ Contact Sign in
comp.lang.c++ only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: Class template specialization with template parameter         

Group: comp.lang.c++ · Group Profile
Author: Greg Herlihy
Date: May 14, 2008 13:20

On May 14, 12:51 pm, flopbucket hotmail.com> wrote:
> Hi,
>
> First, thanks for the reply.
>
>>> Foo uses the normal template, but Foo > for any
>>> types of T1 and T2 uses the specifalization?
>
>> Not sure what you're asking here.
>
> What I was trying to say was that if I declare:
>
> Foo myFoo();

I believe that you mean to declare an object (and not a function):

Foo myFoo;
> The instantiation will be for the normal/not-specialized template.

Yes.
> But if I declare:
>
> Foo > myFoo2();

Again, I believe that you want:

Foo > myFoo2;
> it will use the specialization... and that regardless of the types
> used for std::map (in this case, int and std::string), any
> "Foo >  myFooExample()"  will always
> instantiate the specialization.

The answer depends on how many template parameters "std::map"
requires. The usual number is two - the two specified by the C++
Standard. An implementation however is allowed to require additional
temmplate type parameters for a std::map. So, assuming that std::map
requires only two type parameters, then the answer is "yes".

Greg
no comments
diggit! del.icio.us! reddit!

RELATED THREADS
SubjectArticles qty Group
has anyone used a template from Template Monster?netobjects.fusion10.webdesign ·