Skip to content

Commit

Permalink
Fix constness
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jan 2, 2024
1 parent 4ec9c29 commit 6c3b2d4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/args-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ struct custom_type {

FMT_BEGIN_NAMESPACE
template <> struct formatter<custom_type> {
auto parse(format_parse_context& ctx) const -> decltype(ctx.begin()) {
auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
return ctx.begin();
}

template <typename FormatContext>
auto format(const custom_type& p, FormatContext& ctx) -> decltype(ctx.out()) {
auto format(const custom_type& p, FormatContext& ctx) const
-> decltype(ctx.out()) {
return fmt::format_to(ctx.out(), "cust={}", p.i);
}
};
Expand All @@ -68,11 +69,11 @@ struct to_stringable {

FMT_BEGIN_NAMESPACE
template <> struct formatter<to_stringable> {
auto parse(format_parse_context& ctx) const -> decltype(ctx.begin()) {
auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
return ctx.begin();
}

auto format(to_stringable, format_context& ctx) -> decltype(ctx.out()) {
auto format(to_stringable, format_context& ctx) const -> decltype(ctx.out()) {
return ctx.out();
}
};
Expand Down Expand Up @@ -155,10 +156,11 @@ struct copy_throwable {

FMT_BEGIN_NAMESPACE
template <> struct formatter<copy_throwable> {
auto parse(format_parse_context& ctx) const -> decltype(ctx.begin()) {
auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
return ctx.begin();
}
auto format(copy_throwable, format_context& ctx) -> decltype(ctx.out()) {
auto format(copy_throwable, format_context& ctx) const
-> decltype(ctx.out()) {
return ctx.out();
}
};
Expand Down

0 comments on commit 6c3b2d4

Please sign in to comment.