Skip to content

Commit

Permalink
add make fmt::formatter() const
Browse files Browse the repository at this point in the history
otherwise the tree fails to build:

```
/usr/include/fmt/base.h:1392:29: error: passing ‘const fmt::v11::formatter<boxed::detail::boxed<unsigned int, vtpty::detail::tags::Width>, char, void>’ as ‘this’ argument discards qualifiers [-fpermissive]
 1392 |     ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));
      |                    ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boxed-cpp/boxed.hpp:219:10: note:   in call to ‘auto fmt::v11::formatter<boxed::detail::boxed<T, Tag> >::format(const boxed::detail::boxed<T, Tag>&, fmt::v11::format_context&) [with Type = unsigned int; Tag = vtpty::detail::tags::Width; fmt::v11::format_context = fmt::v11::context]’
  219 |     auto format(boxed::detail::boxed<Type, Tag> const& val, fmt::format_context& ctx)
      |          ^~~~~~
```

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Jul 14, 2024
1 parent fe2f8bb commit e28b094
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/boxed-cpp/boxed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ struct fmt::formatter<boxed::detail::boxed<Type, Tag>>
{
constexpr auto parse(fmt::format_parse_context& ctx) { return ctx.begin(); }

auto format(boxed::detail::boxed<Type, Tag> const& val, fmt::format_context& ctx)
auto format(boxed::detail::boxed<Type, Tag> const& val, fmt::format_context& ctx) const
{
return fmt::format_to(ctx.out(), "{}", val.value);
}
Expand Down

0 comments on commit e28b094

Please sign in to comment.