CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 31 Jul 2025 05:40:12 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/locale/money_put/put/
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 31 Jul 2025 05:40:12 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"8f71-oHHub6yI3QJW2CiKSO4eUQxrsh4"
Content-Encoding: gzip
Formats either units or digits as a sequence of characters expressing a monetary amount.
The function writes the characters resulting from the formatting operation into the sequence whose first character is pointed by s.
An iterator to the character right after the last element written to the output sequence is returned by the function.
Internally, this function simply calls the virtual protected member do_put, which uses the locale selected in str to obtain format details (through facet
This default implementation of do_put is affected by the following format flags of str:
Member type iter_type is the facet's iterator type (defined as an alias of money_put's second template parameter, OutputIterator).
Possible output:
The sequence pointed by s is modified.
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
<locale>
- has_facet
- locale
- use_facet
-
wbuffer_convertC++11
-
wstring_convertC++11
functions
standard facets
money_put
- money_put::money_put
public member functions
protected members
public member function
<locale>
std::money_put::put
numerical (1) | iter_type put (iter_type s, bool intl, ios_base& str, char_type fill, long double units) const; |
---|---|
string (2) | iter_type put (iter_type s, bool intl, ios_base& str, char_type fill, const string_type& digits) const; |
Format monetary expression
The function writes the characters resulting from the formatting operation into the sequence whose first character is pointed by s.
An iterator to the character right after the last element written to the output sequence is returned by the function.
Internally, this function simply calls the virtual protected member do_put, which uses the locale selected in str to obtain format details (through facet
moneypunct<char_type,intl>
) and to widen characters (using ctype::widen).This default implementation of do_put is affected by the following format flags of str:
format flag | flag value | effect |
---|---|---|
showbase | showbase (set) | The currency sign is included in the representation |
noshowbase (not set) | The currency sign is not included in the representation | |
adjustfield | internal | Any fill characters appear where none or space appears in the formatting pattern (see moneypunct::pos_format). |
left | Any fill characters are placed after the other characters. | |
right, or not set | Any fill characters are placed before the other characters. |
Parameters
- s
- Iterator pointing to the first character of the output sequence.
The sequence shall be large enough to accommodate for the whole expression.
Member type iter_type is the facet's iterator type (defined as an alias of time_put's second template parameter, OutputIterator). By default, this is an ostreambuf_iterator, allowing implicit conversions from basic_ostream objects. - intl
true
for international representation,false
otherwise.
This is used to select the proper instatiation of moneypunct.- str
- Object of a class derived from ios_base (generally an output stream object). It is only used to obtain formatting information (nothing is written to this stream by this function).
- fill
- Fill character. The fill character is used in output insertion operations to fill spaces when the format requires some character padding.
Member type char_type is the facet's character type (defined as an alias of time_put's first template parameter, charT).
- units
- Value to be formatted by the function.
- digits
- A string with the digits conforming the monetary value to be written.
Member type string_type is an instantiation of basic_string with the same character type as the facet (defined as an alias ofbasic_string<charT>
, wherecharT
is money_get's first template parameter).
Return value
The next character in the sequence right after the last one written.Member type iter_type is the facet's iterator type (defined as an alias of money_put's second template parameter, OutputIterator).
Example
|
|
Possible output:
13 1295 |
Data races
The facet object is accessed.The sequence pointed by s is modified.
Exception safety
If an exception is thrown, there are no changes in the facet object, although the destination array may have been modified.See also
- money_get::get
- Read monetary expression (public member function)
- num_put::put
- Put numerical value (public member function)
- ostream::operator<<
- Insert formatted output (public member function)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us