I'd rather access it through the setter/getter. But even if I will end up accessing the vector directly instead of having the vector returned, I just would like to understand why this happens.
I tried to reproduce this error, but couldn't. I think you need to show a complete example which can be compiled and run to show the problem. The cause might be in the part of the code which was not shown.
void MyList::setList(std::vector<std::string> list)
{
list = list;
}
Doesn't do what you intend. This is a self-asssignment to a function parameter. (This is why you should mark them `const'.) Disambiguate the name either through the this pointer or rename your parameter.