EDIT: Indeed (*it)->print() works. Sorry for misleading information. When I wrote the question I thought I tried all posibilities. And the last one, even if I wouldn’t have tried it, it seemed wrong to me – pointer to pointer..
Thank you for your time, was a newbie mistake, but it made me see the light!
I’ve started a little project a week ago. Every worked smoothly untill I had this piece of code, where this->_items is std::vector<CItem*> _items;
std::vector<CItem*>::iterator it;
for ( it = this->_items.begin(); it != this->_items.end(); ++it)
{
//MUST use .print() for each Item.
//so:
//it->print() - nope
//(*it).print() -nope - same thing.. STILL!!! What's the problem?
//it.print() - maybe?
//(*it)->print() - come onn!!
}
Ok.. so It didn’t work. After doing some research for std::vector I realised yeah, that’s a template. Let’s do a template. And I kind of did. Header and implementation in one big file, everywhere.. but the project started breaking.
After did translate Class to Template it didn’t work either. So I started adding template <typename T> everywhere untill the red line goes away. It does not.
Here are the changes I’ve done: https://github.com/screws0ft/ubisoft/commit/1b2bd6f9d5d66fcc9315f7a03cc71a2d6f64d57e
So where’s the problem? Could someone help me out?
Appreciate it!
However
(*it)->print()should work.But, you can do it indirectly too:
If none of those don’t work. You have a problem in somewhere else. Did you allocated
CItemobjects correctly? …