Skip to content

Commit

Permalink
Use fmt:: namespace to solve ambiguous call to format_to in c++20
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAce committed Jan 15, 2024
1 parent 1044862 commit ded9ccc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/h5pp/details/h5ppFormatComplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
template<typename T, typename Char>
struct fmt::formatter<std::complex<T>, Char> : fmt::formatter<T, Char> {
private:
typedef fmt::formatter<T, Char> base;
typedef fmt::formatter<T, Char> base;
fmt::detail::dynamic_format_specs<Char> specs_;

public:
template<typename FormatCtx>
auto format(const std::complex<T> &x, FormatCtx &ctx) const -> decltype(ctx.out()) {
base::format(x.real(), ctx);
if(x.imag() >= 0 && specs_.sign != sign::plus) format_to(ctx.out(), "+");
if(x.imag() >= 0 && specs_.sign != sign::plus) fmt::format_to(ctx.out(), "+");
base::format(x.imag(), ctx);
return format_to(ctx.out(), "i");
return fmt::format_to(ctx.out(), "i");
}
};
#endif
Expand Down

0 comments on commit ded9ccc

Please sign in to comment.