mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-26 03:35:22 +00:00
Docs: add comment about empty format context range
This commit is contained in:
parent
ba50c19e82
commit
8644654190
@ -210,6 +210,10 @@ template and implement ``parse`` and ``format`` methods::
|
|||||||
// the formatter should parse the 'f' specifier and return an iterator
|
// the formatter should parse the 'f' specifier and return an iterator
|
||||||
// pointing to '}'.
|
// pointing to '}'.
|
||||||
|
|
||||||
|
// Please also note that this character range may be empty, in case of
|
||||||
|
// the "{}" format string, so therefore you should check ctx.begin()
|
||||||
|
// for equality with ctx.end().
|
||||||
|
|
||||||
// Parse the presentation format and store it in the formatter:
|
// Parse the presentation format and store it in the formatter:
|
||||||
auto it = ctx.begin(), end = ctx.end();
|
auto it = ctx.begin(), end = ctx.end();
|
||||||
if (it != end && (*it == 'f' || *it == 'e')) presentation = *it++;
|
if (it != end && (*it == 'f' || *it == 'e')) presentation = *it++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user