Kefu Chai 274ba2645b
allow format_as() to format reference (#3739)
before this change, format_as() is unable to format a type which
has `auto format_as() -> const another_type&`, and `another_type`
is formattable. because `format_as_result` maps the result type
as it is, and the compiler refuses to compile
`static_cast<T*>(nullptr)`, where T is a reference type. but
it would be handy if we could use `format_as()` to format types
which, for instance, owns / inherit from a formattable type, and
delegate the formatter to these variables instead without creating
a copy of them.

in this change:

* instruct `format_as_result` to map the
  result type to the decayed type, so that `type` can be the decayed
  type of result type, and this also enables `type` to be formattable,
  as long as the decayed type is formattable.
* corresponding test is added to format-test.cc

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2023-12-10 08:49:53 -08:00
..
2023-04-11 06:27:28 -07:00
2023-05-24 11:51:34 -07:00
2023-05-03 07:56:24 -07:00
2021-12-26 16:28:41 -08:00
2023-05-17 12:34:12 -07:00
2023-12-03 08:09:36 -08:00
2023-12-03 08:09:36 -08:00
2023-12-01 08:52:42 -08:00
2023-05-03 07:56:24 -07:00