I wrote the following function to get a date / time string.
Namespace BPT = Promotion: posix_time; String get_date_time_string (bpt :: ptime time) {bpt :: time_facet * facet (new bpt :: time_facet); Facet- & gt; Format ("% Y% m% d% h% m% S"); Stringstream returns_wow; Return_value.imbue (std :: locale (std :: locale :: classic (), aspect)); Return_man & lt; & Lt; Time; Return return_value.str (); } I had a quick question about the ingredient of facet object / delete facet The proprietary / delete is not explicit on ing I tried using shared_ptr , and piled allocated versions of facet Apart from that, both of which had a SEG-fault, no leaks were shown by running the above mentioned work through Valgrind (which probably means that the locale or Section delete is taking care of ING), but I want to make it clear that I am doing the right thing is here thanks. According to , the constructor has given a 0 argument facet it That locale will handle the destruction, and both constructors of bpt :: time_facet will not be able to supply from default to 0. A non-zero value, however, indicates that the programmer must explicitly facet .
Comments
Post a Comment