Commit df1ba52b authored by Victor Zverovich's avatar Victor Zverovich

Update example

parent 221b08fd
...@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment