mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 00:21:13 +00:00
Update README.rst
This commit is contained in:
parent
ca93be130a
commit
8fd7e30f37
18
README.rst
18
README.rst
@ -84,21 +84,21 @@ Format strings can be checked at compile time:
|
|||||||
.. code:: c++
|
.. code:: c++
|
||||||
|
|
||||||
// test.cc
|
// test.cc
|
||||||
using namespace fmt::literals;
|
#include <fmt/format.h>
|
||||||
std::string s = "{2}"_format(42);
|
std::string s = fmt::format(fmt("{2}"), 42);
|
||||||
|
|
||||||
.. code::
|
.. code::
|
||||||
|
|
||||||
$ g++ -Iinclude test.cc -std=c++14
|
$ g++ -Iinclude test.cc -std=c++14
|
||||||
...
|
...
|
||||||
test.cc:5:31: note: in instantiation of function template specialization
|
test.cc:2:22: note: in instantiation of function template specialization 'fmt::format<S, int>' requested here
|
||||||
'fmt::internal::udl_formatter<char, '{', '2', '}'>::operator()<int>' requested
|
std::string s = fmt::format(fmt("{2}"), 42);
|
||||||
here
|
|
||||||
std::string s = "{2}"_format(42);
|
|
||||||
^
|
^
|
||||||
include/fmt/format.h:3838:7: note: non-constexpr function 'on_error' cannot be
|
include/fmt/core.h:749:19: note: non-constexpr function 'on_error' cannot be used in a constant expression
|
||||||
used in a constant expression
|
ErrorHandler::on_error(message);
|
||||||
on_error("argument index out of range");
|
^
|
||||||
|
include/fmt/format.h:2081:16: note: in call to '&checker.context_->on_error(&"argument index out of range"[0])'
|
||||||
|
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``:
|
||||||
|
Loading…
Reference in New Issue
Block a user