How to store a put a template class into a CList object?
-
hi, I have been trying to include a template class into a CList object but i it does not seem to work. I have tried to put in this way in the "Population" class: Typedef Chromosome chromosome CList PopulationArray; Is there any way to put a template class into another template class?? I appreciate your help. Thank you. leonwoo
-
hi, I have been trying to include a template class into a CList object but i it does not seem to work. I have tried to put in this way in the "Population" class: Typedef Chromosome chromosome CList PopulationArray; Is there any way to put a template class into another template class?? I appreciate your help. Thank you. leonwoo
I'm not having problems inserting template classes in a CList: template class Cell { public : T SetData(const T& t) { T old = data; data = t; return old; } T GetData() const { return data; } private : T data; }; CList, Cell > lst;//NOTE--there *must* be a space between the right-most braces : > > lst. Walter Gildersleeve Freiburg, Germany walter.gildersleeve@pe-gmbh.de
-
hi, I have been trying to include a template class into a CList object but i it does not seem to work. I have tried to put in this way in the "Population" class: Typedef Chromosome chromosome CList PopulationArray; Is there any way to put a template class into another template class?? I appreciate your help. Thank you. leonwoo
typedef Chromosome<CGene> chromosome;
CList<chromosome,chromosome> PopulationArray;This should work fine. What error messages are you getting when you try this? --Mike-- http://home.inreach.com/mdunn/ Time is an illusion; lunchtime doubly so.
-
typedef Chromosome<CGene> chromosome;
CList<chromosome,chromosome> PopulationArray;This should work fine. What error messages are you getting when you try this? --Mike-- http://home.inreach.com/mdunn/ Time is an illusion; lunchtime doubly so.
-
I'm not having problems inserting template classes in a CList: template class Cell { public : T SetData(const T& t) { T old = data; data = t; return old; } T GetData() const { return data; } private : T data; }; CList, Cell > lst;//NOTE--there *must* be a space between the right-most braces : > > lst. Walter Gildersleeve Freiburg, Germany walter.gildersleeve@pe-gmbh.de
-
Thanks for your reply, The error message that i've got is "no copy constructor to copy the data type Chromosome". For now i can't remember the complete message but i will put it in after i've copied the message. :) leonwoo
Then you need to write a copy constructor. :cool: --Mike-- http://home.inreach.com/mdunn/ Time is an illusion; lunchtime doubly so.