This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/38399] money_get<> read decimal point when frac_digits() <= 0
- From: "tsyvarev at ispras dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Dec 2008 09:53:33 -0000
- Subject: [Bug libstdc++/38399] money_get<> read decimal point when frac_digits() <= 0
- References: <bug-38399-16694@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from tsyvarev at ispras dot ru 2008-12-05 09:53 -------
Thanks for remark. It seemed for me, that iterator returned by get() and
iterator constructed from stream directly are interchangeable. Now I see that
it isn't so.
Then, example should be rewritten:
#include <locale>
#include <sstream>
#include <iostream>
using namespace std;
class my_moneypunct : public moneypunct<char>
{
protected:
//this should disable fraction part of monetary value
int do_frac_digits()const {return 0;}
};
int main()
{
locale loc(locale(), new my_moneypunct());
stringstream ss("123.455");
ss.imbue(loc);
string digits;
ios_base::iostate err;
istreambuf_iterator<char> iter =
use_facet<money_get<char> >(loc).get(ss, 0, false, ss, err, digits);
string rest = string(iter, istreambuf_iterator<char>());
cout << "digits is \"" << digits << "\"\n";
cout << "rest of stream is \"" << rest << "\"\n";
return 0;
}
Output doesn't change.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38399