Skip to content

Add support for std::complex #3886

Closed
Closed
@dcblack

Description

@dcblack

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 );
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions