How to using boost::locale right way?

Deserialization is working,but it seems to cause a memory leak.

boost::locale::generator gen;
const auto& loc = gen.generate("en_us.UTF-8");
locale::global(loc);
std::ostringstream os;
os.imbue(std::locale(loc, new boost::gregorian::date_facet("%b")));

vector<BOOL>vec{1,0,1,..}; //test
vector<string>vresult;
for(const auto& t:vec){
   if(!t)
     continue;
   boost::gregorian::date  d{1900,10,1};
   os << d;
   vresult.emplace_back(os.str())
}
return result;

Please show me how to correct this code?

  • What is the error? Please provide minimal reproducible example.

    – 

Leave a Comment