[ext.manip] # 31 Input/output library [[input.output]](./#input.output) ## 31.7 Formatting and manipulators [[iostream.format]](iostream.format#ext.manip) ### 31.7.8 Extended manipulators [ext.manip] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7456) The header [](iomanip.syn#header:%3ciomanip%3e "31.7.3 Header synopsis [iomanip.syn]") defines several functions that support extractors and inserters that allow for the parsing and formatting of sequences and values for money and time[.](#1.sentence-1) [🔗](#lib:get_money) `template unspecified get_money(moneyT& mon, bool intl = false); ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7466) *Mandates*: The type moneyT is either long double or a specialization of the basic_string template ([[strings]](strings "27 Strings library"))[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7471) *Effects*: The expression in >> get_money(mon, intl) described below behaves as a [formatted input function](istream.formatted.reqmts "31.7.5.3.1 Common requirements [istream.formatted.reqmts]")[.](#3.sentence-1) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7476) *Returns*: An object of unspecified type such that ifin is an object of type basic_istream then the expression in >> get_money(mon, intl) behaves as if it calledf(in, mon, intl), where the function f is defined as:templatevoid f(basic_ios& str, moneyT& mon, bool intl) {using Iter = istreambuf_iterator; using MoneyGet = money_get; ios_base::iostate err = ios_base::goodbit; const MoneyGet& mg = use_facet(str.getloc()); mg.get(Iter(str.rdbuf()), Iter(), intl, str, err, mon); if (ios_base::goodbit != err) str.setstate(err);} The expression in >> get_money(mon, intl) has typebasic_istream& and value in[.](#4.sentence-2) [🔗](#lib:put_money) `template unspecified put_money(const moneyT& mon, bool intl = false); ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7508) *Mandates*: The type moneyT is either long double or a specialization of the basic_string template ([[strings]](strings "27 Strings library"))[.](#5.sentence-1) [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7513) *Returns*: An object of unspecified type such that ifout is an object of type basic_ostream then the expression out << put_money(mon, intl) behaves as a[formatted output function](ostream.formatted.reqmts "31.7.6.3.1 Common requirements [ostream.formatted.reqmts]") that callsf(out, mon, intl), where the function f is defined as:templatevoid f(basic_ios& str, const moneyT& mon, bool intl) {using Iter = ostreambuf_iterator; using MoneyPut = money_put; const MoneyPut& mp = use_facet(str.getloc()); const Iter end = mp.put(Iter(str.rdbuf()), intl, str, str.fill(), mon); if (end.failed()) str.setstate(ios_base::badbit);} The expression out << put_money(mon, intl) has typebasic_ostream& and value out[.](#6.sentence-2) [🔗](#lib:get_time) `template unspecified get_time(tm* tmb, const charT* fmt); ` [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7544) *Preconditions*: The argument tmb is a valid pointer to an object of type tm, and [fmt, fmt + char_traits​::​length(fmt)) is a valid range[.](#7.sentence-1) [8](#8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7549) *Returns*: An object of unspecified type such that if in is an object of typebasic_istream then the expression in >> get_time(tmb, fmt) behaves as if it called f(in, tmb, fmt), where the function f is defined as:templatevoid f(basic_ios& str, tm* tmb, const charT* fmt) {using Iter = istreambuf_iterator; using TimeGet = time_get; ios_base::iostate err = ios_base::goodbit; const TimeGet& tg = use_facet(str.getloc()); tg.get(Iter(str.rdbuf()), Iter(), str, err, tmb, fmt, fmt + traits::length(fmt)); if (err != ios_base::goodbit) str.setstate(err);} The expression in >> get_time(tmb, fmt) has typebasic_istream& and value in[.](#8.sentence-2) [🔗](#lib:put_time) `template unspecified put_time(const tm* tmb, const charT* fmt); ` [9](#9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7582) *Preconditions*: The argument tmb is a valid pointer to an object of type tm, and [fmt, fmt + char_traits​::​length(fmt)) is a valid range[.](#9.sentence-1) [10](#10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7587) *Returns*: An object of unspecified type such that if out is an object of type basic_ostream then the expressionout << put_time(tmb, fmt) behaves as if it called f(out, tmb, fmt), where the function f is defined as:templatevoid f(basic_ios& str, const tm* tmb, const charT* fmt) {using Iter = ostreambuf_iterator; using TimePut = time_put; const TimePut& tp = use_facet(str.getloc()); const Iter end = tp.put(Iter(str.rdbuf()), str, str.fill(), tmb, fmt, fmt + traits::length(fmt)); if (end.failed()) str.setstate(ios_base::badbit);} The expression out << put_time(tmb, fmt) has typebasic_ostream& and value out[.](#10.sentence-2)