Click here to Skip to main content
15,891,136 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to safely release the memory when I dynamic create the the dialog ? Pin
Cool_Dev18-Aug-10 23:43
Cool_Dev18-Aug-10 23:43 
QuestionHow to get the total files numbers of a whole computer? Pin
Aric Wang18-Aug-10 16:32
Aric Wang18-Aug-10 16:32 
AnswerRe: How to get the total files numbers of a whole computer? Pin
Niklas L18-Aug-10 19:59
Niklas L18-Aug-10 19:59 
QuestionDeadlocked UI need a little help Pin
Spawn@Melmac18-Aug-10 11:33
Spawn@Melmac18-Aug-10 11:33 
AnswerRe: Deadlocked UI need a little help Pin
Spawn@Melmac19-Aug-10 10:52
Spawn@Melmac19-Aug-10 10:52 
QuestionLogging Semaphore names Pin
keloth8718-Aug-10 10:18
keloth8718-Aug-10 10:18 
AnswerRe: Logging Semaphore names Pin
Cool_Dev18-Aug-10 20:40
Cool_Dev18-Aug-10 20:40 
Questionvector of template class Pin
forwardsim18-Aug-10 9:23
forwardsim18-Aug-10 9:23 
Hi,

I want to fill a vector that memorize multiple instances of a template class (those instances potentially use different template type).

Here my question in code :

// a basic template class
template< class T >
class CTest
{
 // something
}

// ...

// then some instances
CTest< int > a;
CTest< int > b;
CTest< double > c;

// Then we can fill a vector like this
vector< CTest< int > * > myints;
myints.push_back( &a );
myints.push_back( &b );

// But, is it possible to do something like that

vector< CTest * > all; // this line compiles

// but not those...
all.push_back( &a ); // fill template class instance using int type 
all.push_back( &c ); // fill template class instance using double type



In short, I don't find the correct way to fill my vector 'all'...
All my tries give a "cannot convert parameter from something to another thing" error.

Anyone know if it is possible and how ?

Thanks in advance for all your answers,

SV
AnswerRe: vector of template class Pin
Richard MacCutchan18-Aug-10 9:44
mveRichard MacCutchan18-Aug-10 9:44 
GeneralRe: vector of template class Pin
forwardsim18-Aug-10 10:08
forwardsim18-Aug-10 10:08 
AnswerRe: vector of template class Pin
Aescleal18-Aug-10 10:10
Aescleal18-Aug-10 10:10 
GeneralRe: vector of template class Pin
forwardsim18-Aug-10 10:34
forwardsim18-Aug-10 10:34 
GeneralRe: vector of template class Pin
Aescleal18-Aug-10 11:11
Aescleal18-Aug-10 11:11 
GeneralRe: vector of template class Pin
forwardsim18-Aug-10 11:02
forwardsim18-Aug-10 11:02 
AnswerRe: vector of template class Pin
Niklas L18-Aug-10 10:30
Niklas L18-Aug-10 10:30 
GeneralRe: vector of template class [modified] Pin
forwardsim18-Aug-10 10:54
forwardsim18-Aug-10 10:54 
GeneralRe: vector of template class Pin
Aescleal18-Aug-10 11:40
Aescleal18-Aug-10 11:40 
GeneralRe: vector of template class Pin
forwardsim18-Aug-10 12:22
forwardsim18-Aug-10 12:22 
GeneralRe: vector of template class Pin
Aescleal18-Aug-10 22:15
Aescleal18-Aug-10 22:15 
GeneralRe: vector of template class Pin
Emilio Garavaglia18-Aug-10 22:23
Emilio Garavaglia18-Aug-10 22:23 
GeneralRe: vector of template class Pin
forwardsim19-Aug-10 4:44
forwardsim19-Aug-10 4:44 
AnswerRe: vector of template class Pin
Niklas L19-Aug-10 2:23
Niklas L19-Aug-10 2:23 
GeneralRe: vector of template class Pin
Aescleal19-Aug-10 3:01
Aescleal19-Aug-10 3:01 
GeneralRe: vector of template class Pin
Niklas L19-Aug-10 3:16
Niklas L19-Aug-10 3:16 
GeneralRe: vector of template class Pin
forwardsim19-Aug-10 4:47
forwardsim19-Aug-10 4:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.