Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iostream flags are edited by tabulate but not restored #35

Closed
dhcabinian opened this issue Feb 7, 2020 · 2 comments
Closed

iostream flags are edited by tabulate but not restored #35

dhcabinian opened this issue Feb 7, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@dhcabinian
Copy link

dhcabinian commented Feb 7, 2020

The following issue occurs where tabulate will override the flags of an iostream and fail to undo the changes after the print. This causes any future prints to have the flags of tabulate.

The issue comes from these locale lines:
std::locale::global(std::locale(locale));

This overrides the global setting for all stringstreams and causes other prints to be affected.

https://stackoverflow.com/questions/17202819/c-reset-locale-to-c-globally

@p-ranav p-ranav added the bug Something isn't working label Feb 13, 2020
@pgaryali
Copy link

Seeing a same issue. The only alternative for me is to call the std::locale::global(...) with the copy of the current locale before calling into tabulate. Any ETA for fixing this?

@p-ranav
Copy link
Owner

p-ranav commented Feb 25, 2020

std::global seems to return the old locale. So, the following change should work right?

auto old_locale = std::locale::global(std::locale(name));
//do some stuff here
std::locale::global(l);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants