I have the next code:
boost::posix_time::time_facet facet("%Y-%m-%dT%H:%M:%f");
std::stringstream ss;
ss.imbue(std::locale(ss.getloc(), &facet));
And when I run the this code it looks like compiler try to free the facet
during ss
destructor call (debuger says it).
When I run this code:
std::stringstream ss;
ss.imbue(std::locale(ss.getloc(), new boost::posix_time::time_facet("%Y-%m-%dT%H:%M:%f")));
all right.
So, I wonder if exists any documentation about this behavior or reason why local
takes ownership. I've tried to find out the explanation but there is nothing in the documentation.
Does std::locale()
take ownership of time_facet?