37template <
class moneyT>
45 template <
class charT,
class Traits>
48 typedef std::istreambuf_iterator<charT>
Iter;
49 typedef std::money_get<charT, Iter>
MoneyGet;
51 std::ios_base::iostate err = std::ios_base::goodbit;
52 const MoneyGet &mg = std::use_facet<MoneyGet>(
strm.getloc ());
57 if (std::ios_base::goodbit != err)
64template <
class moneyT>
72 template <
class charT,
class Traits>
75 typedef std::ostreambuf_iterator<charT>
Iter;
76 typedef std::money_put<charT, Iter>
MoneyPut;
78 const MoneyPut &tp = std::use_facet<MoneyPut>(
strm.getloc ());
85 strm.setstate (std::ios_base::badbit);
91inline std::__rw_smanip<money_get_manip<long double>,
bool>
99 typedef std::__rw_smanip<GetMoney, bool>
Manip;
101 return Manip (GetMoney (pval), intl);
106template <
class charT>
107inline std::__rw_smanip<money_get_manip<std::basic_string<charT> >,
bool>
108get_money (std::basic_string<charT> *pval,
bool intl =
false)
114 typedef std::basic_string<charT>
String;
116 typedef std::__rw_smanip<GetMoney, bool>
Manip;
118 return Manip (GetMoney (pval), intl);
123inline std::__rw_smanip<money_put_manip<long double>,
bool>
131 typedef std::__rw_smanip<PutMoney, bool>
Manip;
133 return Manip (PutMoney (
val), intl);
138template <
class charT>
139inline std::__rw_smanip<money_put_manip<std::basic_string<charT> >,
bool>
146 typedef std::basic_string<charT>
String;
148 typedef std::__rw_smanip<PutMoney, bool>
Manip;
150 return Manip (PutMoney (
val), intl);
154int main (
int argc,
char *argv[])
156 const std::string valstr = argc < 2 ?
"0" : argv [1];
159 std::cin.imbue (std::locale (
""));
160 std::cout.imbue (std::cin.getloc ());
165 std::cout.setf (std::cout.
showbase);
167 std::cout <<
put_money (valstr,
true) <<
'\n';
169 long double val = 0.0L;
176 if (std::cin.good ()) {
181 std::cerr <<
"get_money (long double*) failed\n";
std::ostream_iterator< int, char, std::char_traits< char > > Iter
std::__rw_smanip< money_put_manip< long double >, bool > put_money(const long double &val, bool intl=false)
std::__rw_smanip< money_get_manip< long double >, bool > get_money(long double *pval, bool intl=false)
money_get_manip(moneyT *pval)
void operator()(std::basic_ios< charT, Traits > &strm, bool intl) const
money_put_manip(const moneyT &val)
void operator()(std::basic_ios< charT, Traits > &strm, bool intl) const