Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for std::complex #3886

Closed
dcblack opened this issue Mar 8, 2024 · 1 comment
Closed

Add support for std::complex #3886

dcblack opened this issue Mar 8, 2024 · 1 comment

Comments

@dcblack
Copy link

dcblack commented Mar 8, 2024

Since std::literals allows for std::complex literals, it seems natural that fmt would support them.

#include <complex>
#include "fmt/format.h"

int main() {
  using namespace std::literals;
  auto i1 = 1.0i;
  auto i2 = 2.0if;
  auto i3 = 3.0il;
  auto s = fmt::format( "{} {} {}", i1, i2, i3 ); //< missing formatters for complex numbers
  assert( "1.0i 2.0i 3.0i" == s );
}
@vitaut
Copy link
Contributor

vitaut commented Mar 8, 2024

Thanks for the suggestion. A PR to add a formatter for complex to fmt/std.h would be welcome.

@vitaut vitaut changed the title format.h does not include support for std::complex Add support for std::complex Mar 10, 2024
@vitaut vitaut closed this as completed Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants