Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
080b6899
Commit
080b6899
authored
Nov 17, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak the docs
parent
c01ec54f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
doc/api.rst
doc/api.rst
+4
-3
No files found.
doc/api.rst
View file @
080b6899
...
@@ -124,11 +124,11 @@ template and implement ``parse`` and ``format`` methods::
...
@@ -124,11 +124,11 @@ template and implement ``parse`` and ``format`` methods::
// fmt::format("{:f} - point of interest", point{1, 2});
// fmt::format("{:f} - point of interest", point{1, 2});
//
//
// the range will contain "f} - point of interest". The formatter should
// the range will contain "f} - point of interest". The formatter should
// parse specifiers until '}' or the end of the range. In this example
,
// parse specifiers until '}' or the end of the range. In this example
// 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 '}'.
// Parse
presentation format and store the parse resul
t in the formatter:
// Parse
the presentation format and store i
t 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++;
...
@@ -140,10 +140,11 @@ template and implement ``parse`` and ``format`` methods::
...
@@ -140,10 +140,11 @@ template and implement ``parse`` and ``format`` methods::
return it;
return it;
}
}
// Formats the point p using parsed format specification (presentation)
// Formats the point p using
the
parsed format specification (presentation)
// stored in this formatter.
// stored in this formatter.
template <typename FormatContext>
template <typename FormatContext>
auto format(const point& p, FormatContext& ctx) {
auto format(const point& p, FormatContext& ctx) {
// ctx.out() is an output iterator to write to.
return format_to(
return format_to(
ctx.out(),
ctx.out(),
presentation == 'f' ? "({:.1f}, {:.1f})" : "({:.1e}, {:.1e})",
presentation == 'f' ? "({:.1f}, {:.1f})" : "({:.1e}, {:.1e})",
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment