From 1efdb2dde40a846a4829c0638b8b4405eee651e7 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 8 Jul 2020 07:47:18 -0700 Subject: [PATCH] Simplify readme --- README.rst | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/README.rst b/README.rst index de6099e7..6437227b 100644 --- a/README.rst +++ b/README.rst @@ -111,22 +111,10 @@ Check a format string at compile time: .. code:: c++ - #include + std::string s = fmt::format(FMT_STRING("{:d}"), "don't panic"); - std::string s = format(FMT_STRING("{:d}"), "hello"); - -gives a compile-time error because ``d`` is an invalid format specifier for a -string. - -Use {fmt} as a safe portable replacement for ``itoa`` -(`godbolt `_): - -.. code:: c++ - - fmt::memory_buffer buf; - format_to(buf, "{}", 42); // replaces itoa(42, buffer, 10) - format_to(buf, "{:x}", 42); // replaces itoa(42, buffer, 16) - // access the string with to_string(buf) or buf.data() +This gives a compile-time error because ``d`` is an invalid format specifier for +a string. Create your own functions similar to `format `_ and