template specialization - member function

G

graham

Hi ,

I have two questions.

Given a template class like this;

template <typename T1, typename T2>
class Example
{

public:

template<typename BAR>;
void foo(BAR& seq);
};


1) Is there anything wrong with this type of class declaration? I have
class instances parameterized by T1 and T2 and instances of these can
call foo with other types of parameters. My client code will be like
this (or at least I want it to be :) )

Example<int, long> egIntLong;

std::string str;
egIntLong.foo(str);


Ive greatly simplified obviously, but I hope this conveys what I want
to do. Don't ask me the why I want it that way, I just do :) :)

2) What should the signatture of foo bee when implemented in a .cpp
file? I can't get it right!! :(

thanks and have a nice day

Graham
 
G

graham

Hi ,

I have two questions.

Given a template class like this;

template <typename T1, typename T2>
class  Example
{

public:

  template<typename BAR>;
  void foo(BAR& seq);

};

1) Is there anything wrong with this type of class declaration? I have
class instances parameterized by T1 and T2 and instances of these can
call foo with other types of  parameters. My client code will be like
this (or at least I want it to be :) )

Example<int, long> egIntLong;

std::string str;
egIntLong.foo(str);

Ive greatly simplified obviously, but I hope this conveys what I want
to do. Don't ask me the why I want it that way, I just do :) :)

2)  What should the signatture of foo bee when implemented in a .cpp
file? I can't get it right!! :(

thanks and have a nice day

Graham

Sokay, I got it...
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top