public member function
<locale>
std::num_put::putiter_type put (iter_type out, ios_base& str, char_type fill, bool val) const;iter_type put (iter_type out, ios_base& str, char_type fill, long val) const;iter_type put (iter_type out, ios_base& str, char_type fill, unsigned long val) const;iter_type put (iter_type out, ios_base& str, char_type fill, double val) const;iter_type put (iter_type out, ios_base& str, char_type fill, long double val) const;iter_type put (iter_type out, ios_base& str, char_type fill, const void* val) const;
iter_type put (iter_type out, ios_base& str, char_type fill, bool val) const;iter_type put (iter_type out, ios_base& str, char_type fill, long val) const;iter_type put (iter_type out, ios_base& str, char_type fill, unsigned long val) const;iter_type put (iter_type out, ios_base& str, char_type fill, double val) const;iter_type put (iter_type out, ios_base& str, char_type fill, long double val) const;iter_type put (iter_type out, ios_base& str, char_type fill, const void* val) const;iter_type put (iter_type out, ios_base& str, char_type fill, long long val) const;iter_type put (iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
Put numerical value
Formats val into out as a sequence of characters.The function writes the characters resulting from the formatting operation into the sequence whose first character is pointed by out.
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 by default produces a sequence with the same format as printf does for the format specified that corresponds to the type of argument val taking into account str's format flags and field width. The function uses the locale selected in str to obtain format details (through facet numpunct) and to widen characters (with ctype::widen) when necessary.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// num_put example
#include <iostream> // std::cout
#include <locale> // std::locale, std::num_put, std::use_facet
int main ()
{
std::cout.width(10); // set field width to 10 characters
std::use_facet<std::num_put<char> >(std::cout.getloc()).put
(std::cout, std::cout, '0', 3.14159265);
std::cout << '\n';
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4