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
ecd6022c
Commit
ecd6022c
authored
Feb 08, 2022
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs
parent
afbcf1e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
doc/api.rst
doc/api.rst
+3
-3
No files found.
doc/api.rst
View file @
ecd6022c
...
@@ -227,7 +227,7 @@ template and implement ``parse`` and ``format`` methods::
...
@@ -227,7 +227,7 @@ template and implement ``parse`` and ``format`` methods::
// Formats the point p using the 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) -> decltype(ctx.out()) {
auto format(const point& p, FormatContext& ctx)
const
-> decltype(ctx.out()) {
// ctx.out() is an output iterator to write to.
// ctx.out() is an output iterator to write to.
return presentation == 'f'
return presentation == 'f'
? format_to(ctx.out(), "({:.1f}, {:.1f})", p.x, p.y)
? format_to(ctx.out(), "({:.1f}, {:.1f})", p.x, p.y)
...
@@ -249,7 +249,7 @@ example::
...
@@ -249,7 +249,7 @@ example::
template <> struct fmt::formatter<color>: formatter<string_view> {
template <> struct fmt::formatter<color>: formatter<string_view> {
// parse is inherited from formatter<string_view>.
// parse is inherited from formatter<string_view>.
template <typename FormatContext>
template <typename FormatContext>
auto format(color c, FormatContext& ctx) {
auto format(color c, FormatContext& ctx)
const
{
string_view name = "unknown";
string_view name = "unknown";
switch (c) {
switch (c) {
case color::red: name = "red"; break;
case color::red: name = "red"; break;
...
@@ -287,7 +287,7 @@ You can also write a formatter for a hierarchy of classes::
...
@@ -287,7 +287,7 @@ You can also write a formatter for a hierarchy of classes::
struct fmt::formatter<T, std::enable_if_t<std::is_base_of<A, T>::value, char>> :
struct fmt::formatter<T, std::enable_if_t<std::is_base_of<A, T>::value, char>> :
fmt::formatter<std::string> {
fmt::formatter<std::string> {
template <typename FormatCtx>
template <typename FormatCtx>
auto format(const A& a, FormatCtx& ctx) {
auto format(const A& a, FormatCtx& ctx)
const
{
return fmt::formatter<std::string>::format(a.name(), ctx);
return fmt::formatter<std::string>::format(a.name(), ctx);
}
}
};
};
...
...
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