A std::vector<T>and T* []are not compatible types.
Change your function signature tester()as follows:
int tester(const std::vector<Item>& s)
{
for (size_t i = 0; i < s.size(); ++i){
cout<< s[i]->name<<" "<< s[i]->address<<endl;
}
return 0;
}
There are several ways to convey this std::vector<T>, and they all have slightly different meanings:
void tester(std::vector<Item*>);
void tester(std::vector<Item*>&);
void tester(const std::vector<Item*>&);
void tester(std::vector<Item*>*);
source
share