The problem is that the vector is holding objects of type some_object
but not some_object *
. You are trying to dereference a non-pointer type and compiler is complaining about it. Try -
return &(some_objects[index]);
or
return &(some_objects.at(index));