Templates: Members Vs. non-members

D

Dave

Hello all,

Are the rules for templated member functions different in any way than the
rules for templated non-member functions?

How about templated member classes Vs. templated non-member classes?

Thanks,
Dave
 
V

Victor Bazarov

Dave said:
Are the rules for templated member functions different in any way than the
rules for templated non-member functions?

Rules? Different? I can't recall any, really.
How about templated member classes Vs. templated non-member classes?

Hmm... No.

Why do you ask? Have you run into a problem?

V
 
D

Dave

Victor Bazarov said:
Rules? Different? I can't recall any, really.


Hmm... No.

Why do you ask? Have you run into a problem?

V

Nope. I'm just preparing a presentation and am checking multiple sources to
make sure I'm giving accurate information.
 
T

tom_usenet

Hello all,

Are the rules for templated member functions different in any way than the
rules for templated non-member functions?

Well, of course, since the rules for member functions are different
from the rules for non-member functions, in terms of overloading,
constness, declarations and definitions, etc.
How about templated member classes Vs. templated non-member classes?

You can't specialize a member template of a class template without
fully specializing the class template, but I'm not sure you'd call
that a difference.

When specifying member templates that are dependent names, you need to
use "template" to disambiguate. e.g. to call a template member
function specialization "foo" of a dependently typed object t you need
to do this:

t.template foo<int>();

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top