Add an example.

This commit is contained in:
Victor Zverovich 2013-09-06 15:12:46 -07:00
parent 9b619782a0
commit 1a236c80f3

View File

@ -54,6 +54,13 @@ Arguments can be accessed by position and arguments' indices can be repeated:
std::string s = str(fmt::Format("{0}{1}{0}") << "abra" << "cad"); std::string s = str(fmt::Format("{0}{1}{0}") << "abra" << "cad");
// s == "abracadabra" // s == "abracadabra"
Format can be used as a safe portable replacement to ``itoa``:
.. code-block:: c++
fmt::Writer w;
w << 42; // replaces itoa(42, buffer, 10)
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: