Ch26.7: Manipulator Lookup
1. How to Read This Page
Every entry is in ::fast_io::mnp, the alias for
::fast_io::manipulators. A manipulator wraps one value and is consumed by
the next print or scan call. It is not stream state.
Entries marked module are in the fast_io module export list.
Entries marked header exist in the headers but are not exported by the
module yet. The scan-side *_get family is header-side as a group.
2. Integer Base
| Entry | Signature | Meaning |
|---|---|---|
base<N> |
base<N, showbase = false, full = false>(value) |
Base 2–36, lowercase digits. |
baseupper<N> |
baseupper<N, showbase = false, full = false>(value) |
Base 2–36, uppercase digits where applicable. |
bin |
bin<showbase = false, full = false>(value) |
Base 2. |
oct |
oct<showbase = false, full = false>(value) |
Base 8. |
dec |
dec<showbase = false, full = false>(value) |
Base 10. |
hex |
hex<showbase = false, full = false>(value) |
Base 16, lowercase. |
hexupper |
hexupper<showbase = false, full = false>(value) |
Base 16, uppercase. |
hex0x |
hex0x<full = false>(value) |
Base 16 with a 0x prefix. |
hex0xupper |
hex0xupper<full = false>(value) |
Base 16 with a 0X prefix. |
println(::fast_io::mnp::hex(255)); // ff
println(::fast_io::mnp::hex0x(255)); // 0xff
println(::fast_io::mnp::base<36>(35)); // z
3. Floating Format
| Entry | Signature | Meaning |
|---|---|---|
decimal |
decimal(value), decimal(value, precision) |
Shortest decimal or fixed precision. |
general |
general(value), general(value, precision) |
General floating format. |
fixed |
fixed(value), fixed(value, precision) |
Fixed-point notation. |
scientific |
scientific(value), scientific(value, precision) |
Scientific notation. |
hexfloat |
hexfloat(value), hexfloat(value, precision) |
Hexadecimal floating notation. |
comma_* |
comma_decimal, comma_general,
comma_fixed, comma_scientific,
comma_hexfloat |
The same formats with comma grouping. |
println(::fast_io::mnp::fixed(3.14159, 2)); // 3.14
println(::fast_io::mnp::hexfloat(1.0)); // hexadecimal float
4. Boolean, Width and Alignment
| Entry | Signature | Meaning |
|---|---|---|
boolalpha |
boolalpha<uppercase = false>(bool) |
true/false instead of 1/0. |
width |
width(placement, value, n),
width(placement, value, n, fill) |
Pad to width n; placement is
scalar_placement::left, middle, right or
internal. |
left |
left(value, n), left(value, n, fill) |
Left-align in a field of width n. |
middle |
middle(value, n), middle(value, n, fill) |
Center in a field of width n. |
right |
right(value, n), right(value, n, fill) |
Right-align in a field of width n. |
internal |
internal(value, n), internal(value, n, fill) |
Pad between the sign/base and the digits. |
println(::fast_io::mnp::boolalpha(true));
println(::fast_io::mnp::right(42, 8, '0')); // 00000042
5. Pointer and Handle Views
| Entry | Signature | Meaning |
|---|---|---|
pointervw |
pointervw<uppercase = false>(pointer) |
Print a pointer value, not the object it points to. |
itervw |
itervw<uppercase = false>(iterator) |
Print a contiguous iterator as an address. Header-side. |
funcvw |
funcvw<uppercase = false>(function pointer) |
Print a function pointer. Header-side. |
fieldptrvw |
fieldptrvw<uppercase = false>(member object pointer) |
Print a member-object pointer. Header-side. |
methodvw |
methodvw<uppercase = false>(member function pointer) |
Print a member-function pointer. |
addrvw |
addrvw<uppercase = false>(value) |
Print an address-shaped integer. |
dfvw |
dfvw(value) |
Print a default-form address with 0x and sign. |
handlevw |
handlevw<uppercase = false>(handle) |
Print an OS handle; integral handles use decimal. |
bitfieldvw |
bitfieldvw(value) |
Print a bit-field or byte value as an integer view. |
Be explicit when a pointer is meant to be data. Passing a char const *
directly prints the pointer value, not the string; use os_c_str or
strvw for the text.
6. String and Range Views
| Entry | Signature | Meaning |
|---|---|---|
os_c_str |
os_c_str(ptr, n), os_c_str(range) |
OS-native string with a known size; stops at NUL. |
os_c_str_carr |
os_c_str_carr(array) |
Same, for a character array. |
os_c_str_null_terminated |
os_c_str_null_terminated(ptr, n) |
NUL-terminated string with a known capacity. |
os_c_str_null_terminated_carr |
os_c_str_null_terminated_carr(array) |
Same, for a character array. |
os_c_str_or_nullptr |
os_c_str_or_nullptr(ptr) |
Print a string or a null representation. |
os_c_str_with_known_size |
os_c_str_with_known_size(ptr, n) |
String with an explicit byte/character count. |
strvw |
strvw(first, last), strvw(range) |
Non-owning character range as a scatter. |
rgvw |
rgvw(range, separator) |
Print a range with a separator between elements. |
::fast_io::string_view sv{"hello"};
println(::fast_io::mnp::strvw(sv));
println(::fast_io::mnp::rgvw(::fast_io::array<int, 3>{1, 2, 3}, ", "));
7. Encoding, Binary, Network and Errors
| Entry | Signature | Meaning |
|---|---|---|
code_cvt |
code_cvt<src, dst>(value) |
Convert between encoding schemes during output. |
code_cvt_os_c_str |
code_cvt_os_c_str<src, dst>(ptr[, n]) |
Encoding conversion for a C string. |
leb128_put |
leb128_put(value) |
Write a LEB128 integer. |
leb128_get |
leb128_get(ref) |
Read a LEB128 integer into ref. |
ip_generic |
ip_generic(ip) |
Print an IPv4/IPv6/address/port type with flags. |
ip_scan_generic |
ip_scan_generic(ip&) |
Scan into an IP type with flags. |
cur_src_loc |
cur_src_loc(source_location = current()) |
Print file, line, column and function. |
name, message, name_message |
error query wrappers | Print the name, message or both for a herbception error. |
posix_equivalent_* |
error query wrappers | The POSIX-equivalent name/message forms. |
lc_dump |
lc_dump(locale) |
Print the whole locale as text. |
lf, crlf, cr |
lf(), crlf(), cr() |
Line skippers for scanning. |
ip_flags, ip_scan_default_flags, scalar_flags,
scalar_manip_t, ip_manip_t and the placement/format enums are
the types behind these values. They are documented with the export list in
Ch26.1.
8. Scan-Side Manipulators
These are the header-side counterparts used by scan. They are not exported
by the module yet.
| Entry | Signature | Meaning |
|---|---|---|
ch_get |
ch_get(ref) |
Read one character without treating it as a number. |
base_get<N> |
base_get<N, noskipws, skipzero, prefix>(ref) |
Read an integer in base 2–36. |
bin_get, oct_get, dec_get, hex_get |
same flag shape as base_get |
Base-specific integer reads. |
addrvw_get |
addrvw_get(ref) |
Read an address-shaped hex integer. |
strlike_get |
strlike_get(ref) |
Read a whitespace-delimited token into a string-like destination. |
strlike_line_get |
strlike_line_get(ref) |
Read one line into a string-like destination. |
strlike_whole_get |
strlike_whole_get(ref) |
Read the whole remaining input. |
int x{};
::fast_io::io::scan(in, ::fast_io::mnp::hex_get(x));
::fast_io::string line;
::fast_io::io::scan(in, ::fast_io::mnp::strlike_line_get(line));
Key Takeaways
- Manipulators are one-argument wrappers, not persistent stream state.
- Integer base, floating format, width, pointer and string views are the main output families.
boolalpha,ip_generic,leb128_put,code_cvtand the error query wrappers cover the remaining output domains.- Scan-side
*_getmanipulators are separate from output manipulators. - Module-exported and header-only entries are marked; do not assume a header helper is in the module contract.
- A raw
char const *prints as a pointer; wrap it inos_c_strorstrvwfor text.