You can continue using imbue
if you specify a custom grouping for numbers.
See an example here: http://www.cplusplus.com/reference/locale/numpunct/grouping/
Taking that example we have this code which verifies that no grouping is done even though the locale is set.
// numpunct::grouping example
#include <iostream> // std::cout
#include <string> // std::string
#include <locale> // std::locale, std::numpunct, std::use_facet
// custom numpunct with grouping:
struct my_numpunct : std::numpunct<char> {
// the zero by itself means do no grouping
std::string do_grouping() const {return "\0";}
};
int main() {
std::locale loc (std::cout.getloc(),new my_numpunct);
std::cout.imbue(loc);
std::cout << "one million: " << 1000000 << '\n';
return 0;
}