std::put_money (3) - Linux Manuals
std::put_money: std::put_money
NAME
std::put_money - std::put_money
Synopsis
Defined in header <iomanip>
template< class MoneyT > (since C++11)
/*unspecified*/ put_money( const MoneyT& mon, bool intl = false );
When used in an expression out << put_money(mon, intl), converts the monetary value mon to its character representation as specified by the std::money_put facet of the locale currently imbued in out.
The insertion operation in out << put_money(mon, intl) behaves as a FormattedOutputFunction.
Parameters
mon - a monetary value, either long double or std::basic_string
intl - use international currency strings if true, use currency symbols otherwise
Return value
Returns an object of unspecified type such that if out is the name of an output stream of type std::basic_ostream<CharT, Traits>, then the expression out << put_money(mon, intl) behaves as if the following code was executed:
typedef std::ostreambuf_iterator<CharT, Traits> Iter;
typedef std::money_put<CharT, Iter> MoneyPut;
const MoneyPut& mp = std::use_facet<MoneyPut>(out.getloc());
const Iter end = mp.put(Iter(out.rdbuf()), intl, out, out.fill(), mon);
if (end.failed())
out.setstate(std::ios::badbit);
Example
// Run this code
Output:
See also
money_put (class template)
get_money parses a monetary value
(C++11)