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
df1ba52b
Commit
df1ba52b
authored
Apr 22, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update example
parent
221b08fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
README.rst
README.rst
+6
-5
No files found.
README.rst
View file @
df1ba52b
...
@@ -97,14 +97,15 @@ Format strings can be checked at compile time:
...
@@ -97,14 +97,15 @@ Format strings can be checked at compile time:
context_.on_error("argument index out of range");
context_.on_error("argument index out of range");
^
^
{fmt} can be used as a safe portable replacement for ``itoa``:
{fmt} can be used as a safe portable replacement for ``itoa``
(`godbolt <https://godbolt.org/g/NXmpU4>`_):
.. code:: c++
.. code:: c++
fmt::
MemoryWriter w
;
fmt::
memory_buffer buf
;
w << 42;
// replaces itoa(42, buffer, 10)
format_to(buf, "{}", 42);
// replaces itoa(42, buffer, 10)
w << fmt::hex(42);
// replaces itoa(42, buffer, 16)
format_to(buf, "{:x}", 42);
// replaces itoa(42, buffer, 16)
// access the string using
w.str() or w.c_str
()
// access the string using
to_string(buf) or buf.data
()
An object of any user-defined type for which there is an overloaded
An object of any user-defined type for which there is an overloaded
:code:`std::ostream` insertion operator (``operator<<``) can be formatted:
:code:`std::ostream` insertion operator (``operator<<``) can be formatted:
...
...
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