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
8630a8f5
Commit
8630a8f5
authored
Jun 25, 2020
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak the docs
parent
cc3a88e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
doc/api.rst
doc/api.rst
+7
-5
include/fmt/compile.h
include/fmt/compile.h
+5
-5
No files found.
doc/api.rst
View file @
8630a8f5
...
@@ -427,11 +427,13 @@ The format string syntax is described in the documentation of
...
@@ -427,11 +427,13 @@ The format string syntax is described in the documentation of
Format string compilation
Format string compilation
=========================
=========================
Format strings can be processed at compile time for built-in and string types
``fmt/compile.h`` provides format string compilation support. Format strings
as well as user-defined types with ``constexpr`` ``parse`` functions in their
are parsed at compile time and converted into efficient formatting code. This
``formatter`` specializations. Format string compilation can generate more
supports arguments of built-in and string types as well as user-defined types
binary code compared to the normal API and is only recommended in places where
with ``constexpr`` ``parse`` functions in their ``formatter`` specializations.
formatting is a performance bottleneck.
Format string compilation can generate more binary code compared to the default
API and is only recommended in places where formatting is a performance
bottleneck.
.. doxygendefine:: FMT_COMPILE
.. doxygendefine:: FMT_COMPILE
...
...
include/fmt/compile.h
View file @
8630a8f5
...
@@ -23,14 +23,14 @@ struct is_compiled_string : std::is_base_of<compiled_string, S> {};
...
@@ -23,14 +23,14 @@ struct is_compiled_string : std::is_base_of<compiled_string, S> {};
/**
/**
\rst
\rst
Con
structs a format string that will be translated into an efficien
t
Con
verts a string literal *s* into a format string that will be parsed a
t
formatting code at compile time from a string literal *s*
. Requires C++17
compile time and converted into efficient formatting code
. Requires C++17
``constexpr if``.
``constexpr if``
compiler support
.
**Example**::
**Example**::
// Converts 42 into std::string using the most efficient
code and no runtime
// Converts 42 into std::string using the most efficient
method and no
// format string processing.
//
runtime
format string processing.
std::string s = fmt::format(FMT_COMPILE("{}"), 42);
std::string s = fmt::format(FMT_COMPILE("{}"), 42);
\endrst
\endrst
*/
*/
...
...
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