By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,804 Members | 1,681 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,804 IT Pros & Developers. It's quick & easy.

Template binder

P: n/a
Hello All!

Is there a way to implement the following:

.....
template<class T, class U>
class Test;
......

Test<int, char> test1;

// Note : not C++
typedef TemplateBinder<Test, char>::Result CharTest;

CharTest<int> test2; /// In fact test1 == test2

P.S.
Turn attention to Result!
It isn't a type, it's a template.

Thanks!

Jun 20 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
kr*************@gmail.com wrote:
Hello All!

Is there a way to implement the following:

....
template<class T, class U>
class Test;
.....

Test<int, char> test1;

// Note : not C++
typedef TemplateBinder<Test, char>::Result CharTest;

CharTest<int> test2; /// In fact test1 == test2

P.S.
Turn attention to Result!
It isn't a type, it's a template.


So basically, you're asking if there is a templated typedef in C++. There
currently isn't. AFAIK, it is considered for the next version of the C++
standard.

Jun 20 '06 #2

P: n/a

Rolf Magnus wrote:
kr*************@gmail.com wrote:
Hello All!

Is there a way to implement the following:

....
template<class T, class U>
class Test;
.....

Test<int, char> test1;

// Note : not C++
typedef TemplateBinder<Test, char>::Result CharTest;

CharTest<int> test2; /// In fact test1 == test2

P.S.
Turn attention to Result!
It isn't a type, it's a template.


So basically, you're asking if there is a templated typedef in C++. There
currently isn't. AFAIK, it is considered for the next version of the C++
standard.


Is there a way to emulate this plaguy omission?

Jun 20 '06 #3

P: n/a

<kr*************@gmail.com> wrote in message |

| > So basically, you're asking if there is a templated typedef in C++.
There
| > currently isn't. AFAIK, it is considered for the next version of the C++
| > standard.
|
| Is there a way to emulate this plaguy omission?

There is a Gotw article on this. Here is the link --
http://gotw.ca/gotw/079.htm.

Sharad
Jun 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.