mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 11:28:20 +00:00
Update changelog
This commit is contained in:
parent
5ad54256c5
commit
8b246531e6
@ -41,11 +41,11 @@
|
|||||||
|
|
||||||
.. code:: c++
|
.. code:: c++
|
||||||
|
|
||||||
struct S {};
|
struct Answer {};
|
||||||
|
|
||||||
namespace fmt {
|
namespace fmt {
|
||||||
template <>
|
template <>
|
||||||
struct formatter<S> {
|
struct formatter<Answer> {
|
||||||
constexpr auto parse(parse_context& ctx) {
|
constexpr auto parse(parse_context& ctx) {
|
||||||
auto it = ctx.begin();
|
auto it = ctx.begin();
|
||||||
spec = *it;
|
spec = *it;
|
||||||
@ -55,7 +55,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename FormatContext>
|
template <typename FormatContext>
|
||||||
auto format(S, FormatContext& ctx) {
|
auto format(Answer, FormatContext& ctx) {
|
||||||
return spec == 's' ?
|
return spec == 's' ?
|
||||||
format_to(ctx.begin(), "{}", "fourty-two") :
|
format_to(ctx.begin(), "{}", "fourty-two") :
|
||||||
format_to(ctx.begin(), "{}", 42);
|
format_to(ctx.begin(), "{}", 42);
|
||||||
@ -65,10 +65,10 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string s = format(fmt("{:x}"), S());
|
std::string s = format(fmt("{:x}"), Answer());
|
||||||
|
|
||||||
gives a compile-time error due to invalid format specifier (`godbolt
|
gives a compile-time error due to invalid format specifier (`godbolt
|
||||||
<https://godbolt.org/g/ywhrPp>`_)::
|
<https://godbolt.org/g/2jQ1Dv>`_)::
|
||||||
|
|
||||||
...
|
...
|
||||||
<source>:12:45: error: expression '<throw-expression>' is not a constant expression
|
<source>:12:45: error: expression '<throw-expression>' is not a constant expression
|
||||||
|
Loading…
Reference in New Issue
Block a user