From 8fd7e30f37ce7890b5831cd6cd282ff25291b1a2 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 9 Mar 2018 15:44:46 -0800 Subject: [PATCH] Update README.rst --- README.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 7d144cad..757d0b99 100644 --- a/README.rst +++ b/README.rst @@ -84,22 +84,22 @@ Format strings can be checked at compile time: .. code:: c++ // test.cc - using namespace fmt::literals; - std::string s = "{2}"_format(42); + #include + std::string s = fmt::format(fmt("{2}"), 42); .. code:: $ g++ -Iinclude test.cc -std=c++14 ... - test.cc:5:31: note: in instantiation of function template specialization - 'fmt::internal::udl_formatter::operator()' requested - here - std::string s = "{2}"_format(42); - ^ - include/fmt/format.h:3838:7: note: non-constexpr function 'on_error' cannot be - used in a constant expression - on_error("argument index out of range"); - ^ + test.cc:2:22: note: in instantiation of function template specialization 'fmt::format' requested here + std::string s = fmt::format(fmt("{2}"), 42); + ^ + include/fmt/core.h:749:19: note: non-constexpr function 'on_error' cannot be used in a constant expression + ErrorHandler::on_error(message); + ^ + 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``: