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
9b392a68
Commit
9b392a68
authored
Mar 16, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update readme
parent
0fa65cf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
README.rst
README.rst
+5
-4
No files found.
README.rst
View file @
9b392a68
...
@@ -61,14 +61,15 @@ Print ``Hello, world!`` to ``stdout``:
...
@@ -61,14 +61,15 @@ Print ``Hello, world!`` to ``stdout``:
.. code:: c++
.. code:: c++
fmt::print("Hello, {}!", "world"); //
uses
Python-like format string syntax
fmt::print("Hello, {}!", "world"); // Python-like format string syntax
fmt::printf("Hello, %s!", "world"); //
uses
printf format string syntax
fmt::printf("Hello, %s!", "world"); // printf format string syntax
Format a string and use positional arguments:
Format a string and use positional arguments:
.. code:: c++
.. code:: c++
std::string s = fmt::format("I'd rather be {1} than {0}.", "right", "happy");
std::string s = fmt::format("I'd rather be {1} than {0}.", "right", "happy");
// s == "I'd rather be happy than right."
Check a format string at compile time:
Check a format string at compile time:
...
@@ -101,7 +102,7 @@ Use {fmt} as a safe portable replacement for ``itoa``
...
@@ -101,7 +102,7 @@ Use {fmt} as a safe portable replacement for ``itoa``
fmt::memory_buffer buf;
fmt::memory_buffer buf;
format_to(buf, "{}", 42); // replaces itoa(42, buffer, 10)
format_to(buf, "{}", 42); // replaces itoa(42, buffer, 10)
format_to(buf, "{:x}", 42); // replaces itoa(42, buffer, 16)
format_to(buf, "{:x}", 42); // replaces itoa(42, buffer, 16)
// access the string
using
to_string(buf) or buf.data()
// access the string
with
to_string(buf) or buf.data()
Formatting of user-defined types is supported via a simple
Formatting of user-defined types is supported via a simple
`extension API <http://fmtlib.net/latest/api.html#formatting-user-defined-types>`_:
`extension API <http://fmtlib.net/latest/api.html#formatting-user-defined-types>`_:
...
@@ -148,7 +149,7 @@ which take arbitrary arguments (`godbolt <https://godbolt.org/g/MHjHVf>`_):
...
@@ -148,7 +149,7 @@ which take arbitrary arguments (`godbolt <https://godbolt.org/g/MHjHVf>`_):
report_error("file not found: {}", path);
report_error("file not found: {}", path);
Note that ``vreport_error`` is not parameterized on argument types which can
Note that ``vreport_error`` is not parameterized on argument types which can
improve compile times and reduce code size compared to fully parameterized
improve compile times and reduce code size compared to
a
fully parameterized
version.
version.
Benchmarks
Benchmarks
...
...
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