Skip to content
forked from fmtlib/fmt

Commit

Permalink
fix: mark fmt::streamed() as constexpr (fmtlib#3650)
Browse files Browse the repository at this point in the history
Because it's just performing a very basic type conversion that can be
done at constexpr time.

My use case simultaneously creates a
`fmt::basic_format_string<some_type_conversion<Args...>>` instance and
performs `some_type_conversion<Args>(args)...`. `some_type_conversion`
optionally applies `fmt::streamed(arg)` to a subset of types. This needs
to be `constexpr` because `basic_format_string`'s constructor is
`consteval`.
  • Loading branch information
muggenhor authored and ckerr committed Nov 7, 2023
1 parent 9fa0a86 commit ee4beb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct formatter<detail::streamed_view<T>, Char>
\endrst
*/
template <typename T>
auto streamed(const T& value) -> detail::streamed_view<T> {
constexpr auto streamed(const T& value) -> detail::streamed_view<T> {
return {value};
}

Expand Down

0 comments on commit ee4beb1

Please sign in to comment.