------- 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

Reply via email to