std::formatter<E, CharT>¶
Part of Formatting.
Formatting of tensors and expressions with std::format.
Any element that std::format takes, element by element, with no temporary: a lazy expression is read where it is printed.
The format spec follows the one of a range ([format.range.formatter]), with options of its own where a range has its type:
The options, in any order, each once:
n: no outer brackets, as for a range;l: on one line, as a range of ranges prints:[[0, 2, 4], [1, 3, 5]];?: a header first: the kind of node, the element type and the shape;a: every element, however many;eN:Nelements at each end of every axis longer than2 N,...between them;wN: lines ofNcharacters at most, 75 by default as in NumPy; rows wrap past it.
By default the tensor is printed over lines, as NumPy prints an array, its columns aligned to the widest element; past 1000 elements only 3 at each end of every axis are, as in NumPy. The fill, alignment and width apply to the whole text, as for a range.
Template parameters
| Name | Description |
|---|---|
E | A tensor expression whose values std::format takes. |
CharT | The character type of the format string. |
Members¶
parse¶
constexpr std::basic_format_parse_context<CharT>::iterator parse(std::basic_format_parse_context<CharT> &ctx)
Parses the options of the tensor, then the spec of its elements after :.
format¶
Writes the tensor.