I have a class with a container (containing pointer) as a member:
MyClass{
private:
std::vector _VecMyObjs;
public:
const std::vector
Aside from changing the signature to remove the const from the vector (as it's a copy of the vector), I'm assuming that you don't want people outside to modify the contents, as a result, make a const pointer , i.e.
vector ACI_CALL MyClass::GetVecMyObjs()
{
return vector(_VecMyObjs.begin(), _VecMyObjs.end());
}
Now the returned vector is a copy, which contain const pointer (which means you can't modify the pointed object via this pointer) - well that's the agreement, there's nothing preventing someone from const_casting that away (using that is UB anyways!)
If you really want to prevent modifications, return a copy (or clone of each object) in the vector.