473,413 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Template binder

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
3 1642
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

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

<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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Rex_chaos | last post by:
Hi all, Here is a std::vector containing some std::complex<double>. I would like to take the amplitude of the complex array. i.e. v = amp of v = I try a template function but didn't work ...
2
by: Pankaj Bhagat | last post by:
Hi, This is in context with compiler and linker Can someone let me know 1) what is a binder? where is it needed? What does it do in a compiling process? ----------------- 2) When I have a...
31
by: nikola | last post by:
Hi all, I was working with a simple function template to find the min of two values. But since I would like the two values to be different (type) I dont know what kind of value (type) it will...
2
by: Rudy Ray Moore | last post by:
Whenever I get any error with Vc++7.1/.net/2003, it is followed by huge ammounts of "template assistance" error messaging referencing template code (MTL) that has nothing to do with the error. ...
6
by: astro | last post by:
I'm working through the binder stuff trying to get a handle on it... I have setup a master-detail dataset and have a couple of textboxes from the master along with a datadgrid for the child data....
3
by: Diego Martins | last post by:
Let's say I have a vector of pointers of Base vector<Base *vec; Now, someone assured me all elements of the vector are of dynamic type Derived *. I want to use for_each or other STL...
19
by: aaragon | last post by:
Hi everyone. A very simple question. I would like to know what is better in terms of performance. I want to use a simple function to obtain the minimum of two values. One way could be using a...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
272
by: Peter Olcott | last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a I think that the operator() member function does not work correctly, does anyone else know how to make a template for making two...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.