I have a vector of pointers, and I'm trying to overload the ostream operator to make printing easier. However, I can't seem to get the function to be called. Here is my code:
std::vector<Set*> sets;
for (int i = 0; i < sets.size(); i++) {
std::cout << sets[i] << std::endl;
}
std::ostream& operator<<(std::ostream& out, const Set* s) {
//Print set code
}
I loop through all the sets and call the specific set for printing by putting sets[i] in the ostream, yet the function is not called. It just prints the address of sets[i]. I had this working when I had a vector of Set, but when I tried to change it to a vector of Set*, I couldn't get it to work. Where am I going wrong?