Huh? Help?
-
file_length = (int) src_topic_file->GetLength(); total_topics = file_length / TOPIC_SIZE; TopicVector.SetSize(total_topics); for (int i=0; i<total_topics; i++) { src_topic_file->Seek(TOPIC_SIZE*i,0); dwRead = src_topic_file->Read(buffer, TOPIC_SIZE); topic.SetTopicData((TOPIC*)buffer); TopicVector.Add(topic); }
TopicVector is CArray<CTopicItem,CTopicItem> topic is CTopicItem as well (derived from CObject) I have a Compile Error on the .Add line with Cannot Convert Parameter 1 from CTopicItem to CTopicItem am I doing something wrong? Ryan Baillargeon Software Specialist Fuel Cell Technologies Inc.
-
file_length = (int) src_topic_file->GetLength(); total_topics = file_length / TOPIC_SIZE; TopicVector.SetSize(total_topics); for (int i=0; i<total_topics; i++) { src_topic_file->Seek(TOPIC_SIZE*i,0); dwRead = src_topic_file->Read(buffer, TOPIC_SIZE); topic.SetTopicData((TOPIC*)buffer); TopicVector.Add(topic); }
TopicVector is CArray<CTopicItem,CTopicItem> topic is CTopicItem as well (derived from CObject) I have a Compile Error on the .Add line with Cannot Convert Parameter 1 from CTopicItem to CTopicItem am I doing something wrong? Ryan Baillargeon Software Specialist Fuel Cell Technologies Inc.
Did you make CTopicItem copy c'tor protected or private? CArray::Add uses 2nd template argument as data type of its parameter, so basically you're passing CTopicItem by value, which involves copying. Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
-
Did you make CTopicItem copy c'tor protected or private? CArray::Add uses 2nd template argument as data type of its parameter, so basically you're passing CTopicItem by value, which involves copying. Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
-
Thank you. (for making me revel in my own stupidity). The class didnt have the = or copy constructor. Ryan Baillargeon Software Specialist Fuel Cell Technologies Inc.
You may consider changing 2nd CArray template argument to const CTopicItem & anyway. This will change the way arguments are passed to CArray::Add and few other methods. Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
-
You may consider changing 2nd CArray template argument to const CTopicItem & anyway. This will change the way arguments are passed to CArray::Add and few other methods. Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
-
Can you please show me what my operator= function should look like? Ryan Baillargeon Software Specialist Fuel Cell Technologies Inc.
It depends on the internals of CTopicItem of course. Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***