The second approach is almost always more desirable. It adds a little extra abstraction that is just enough to be quite useful.
For example, with the second approach, you can move your member variable to any other composite inside your class and still maintain the interface. You can even move it to a PIMPL and drop the requirement to include <list>
. Or you can make the function virtual and move the member elsewhere. It makes basically all the code that uses your class more resistant to change, which is always good.
In its most basic form, the function is usually even inlined, making the abstraction free during runtime.
Now the only aspect that isn't really free is programmer-time, and if you think that it is more cost effective to leave out writing the function, so be it. But then you should probably use one of the "dumb" aggregate types, such as tuple<>
or pair<>