#include <list>
#include <string>
#include <iostream>
int main()
{
std::list<std::string*> *listStr = new std::list<std::string*>();
listStr->push_back(new std::string("HI"));
std::cout << *(listStr->begin()) << std::endl;
return 0;
}
I think I should be getting HI, but I got address as output
008A2B10 Press any key to continue . . .
I can't find my mistake..or have I misunderstood something?
You're printing the pointer in the container.
You need one dereference for the iterator, and another one for the pointer to the string object.