This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Fix initialization of _M_grouping
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 29 Jan 2002 10:38:41 -0800 (PST)
- Subject: Re: [PATCH] Fix initialization of _M_grouping
> Nathan, may I consider this comment of yours as a permission to commit?
Please hold on. I was gone yesterday afternoon and didn't see any of
this.
I'm trying to figure out if this is what Nathan is talking about:
#include <locale>
#include <sstream>
struct testpunct : std::numpunct<char>
{
// char do_thousands_sep() const { return '0'; }
char do_thousands_sep() const { return '\0'; }
std::string do_grouping() const { return std::string("\004"); }
};
int main()
{
// "1\00023\00045"
// "1,0023,0045"
const std::string str("1\00023\00045", 7);
std::stringstream ss(str);
const std::locale loc(std::locale::classic(), new testpunct);
ss.imbue(loc);
long l;
ss >> l;
assert(l == 1023045);
return 0;
}