Re: [patch] Some std::locale improvements

2014-12-09 Thread Jonathan Wakely
On 30/11/14 20:48 +, Jonathan Wakely wrote: I think we also need this to make __numpunct_cache and __moneypunct_cache exception-safe. If we set _M_allocated=true at the start of the _M_cache functions and then an allocation throws we will delete[] the memory allocated in _M_cache, but then th

Re: [patch] Some std::locale improvements

2014-11-30 Thread Jonathan Wakely
Finally, does anyone know why we don't use the stored size in the facet virtual functions that return strings? e.g. virtual string do_grouping() const { return _M_data->_M_grouping; } We could save the cost of a strlen call: virtual string do_grouping() const { ret

Re: [patch] Some std::locale improvements

2014-11-30 Thread Jonathan Wakely
I think we also need this to make __numpunct_cache and __moneypunct_cache exception-safe. If we set _M_allocated=true at the start of the _M_cache functions and then an allocation throws we will delete[] the memory allocated in _M_cache, but then the cache's destructor will see _M_allocated==true