CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Fri, 25 Jul 2025 20:04:54 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/locale/num_put/put/
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 25 Jul 2025 20:04:54 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"8c5e-yYWooRzZZ+wM7kUDBjlNdTAggMM"
Content-Encoding: gzip
Formats val into out as a sequence of characters.
For the process, it uses the formatting options selected in the object passed as str (using its ios_base::fmtflags value and its imbued locale), as well as fill as fill character.
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.
Member type iter_type is the facet's iterator type (defined as an alias of num_put's second template parameter, OutputIterator).
Possible output:
The array pointed by out is modified on success.
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
num_put
- num_put::num_put
public member functions
protected members
public member function
<locale>
std::num_put::put
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, 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
For the process, it uses the formatting options selected in the object passed as str (using its ios_base::fmtflags value and its imbued locale), as well as fill as fill character.
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.
Parameters
- out
- Iterator pointing to the first character where the representation as a sequence of characters is stored.
The sequence shall be long enough to contain the whole expression.
Member type iter_type is the facet's iterator type (defined as an alias of num_put's second template parameter, OutputIterator). By default, this is an ostreambuf_iterator, allowing implicit conversions from basic_ostream objects. - str
- Object of a class derived from ios_base (generally an output stream object). It is only used to obtain formatting information.
- fill
- Fill character: The fill character is used in output insertion operations to fill spaces when results have to be padded to the field width.
Member type char_type is the facet's character type (defined as an alias of num_put's first template parameter, charT). - val
- Value to be formatted.
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 num_put's second template parameter, OutputIterator).
Example
|
|
Possible output:
0003.14159 |
Data races
The object is accessed.The array pointed by out is modified on success.
Exception safety
If an exception is thrown, there are no changes in the facet object, although some of arguments may be affected.See also
- num_get::get
- Get numeric 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