43 explicit LocaleGuard(
const char* new_locale,
int category = LC_ALL)
48 const char* old = std::setlocale(category_,
nullptr);
53 if (std::setlocale(category_, new_locale) !=
nullptr) {
57 aError(
"failed to set locale '%s'", new_locale);
63 if (active_ && !old_locale_.empty()) {
64 std::setlocale(category_, old_locale_.c_str());
72 A_DISABLE_COPY(LocaleGuard);
77 std::string old_locale_;