is it possible to iterate through until the end of list in main() function using the const_iterator? I tried using iter->end() but i can't figure it out.
#include <list>
#include <string>
using std::list;
using std::string;
class list_return
{
public:
list <string>::const_iterator get_list()
{
_list.push_back("1");
_list.push_back("2");
_list.push_back("3");
return _list.begin();
}
private:
list <string> _list;
};
int main()
{
list_return lr;
list <string>::const_iterator iter = lr.get_list();
//here, increment the iterator until end of list
return 0;
}