i have two objects that look like this:
class Object
{
};
class List
{
public:
std::vector<std::shared_ptr<Object>> list;
};
and i want to be able to create a range-based Loop like this:
for (Object& object : list) {
//...
}
for that i created the begin() and end() members:
class List
{
public:
std::vector<std::shared_ptr<Object>> list;
Object& begin() { return *list.begin()->get(); }
const Object& begin() const { return *list.begin()->get(); }
Object& end() { return *list.end()->get(); }
const Object& end() const { return *list.end()->get(); }
};
but the IDE is now asking me for the operators *, ++ and != and i dont undestand how i am supossed to implement can i get some help with that?