Neargye / magic_enum

Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code
MIT License
4.98k stars 444 forks source link

Parameterize formatter::format to use with FMT_COMPILE #365

Closed ArtfulVampire closed 4 months ago

ArtfulVampire commented 4 months ago

https://github.com/fmtlib/fmt/issues/4059#issuecomment-2214074477

tested by adding fmt library into make_test and running the case

TEST_CASE("format-fmt") {
  REQUIRE(fmt::format("{}", Color::RED) == "red");
  REQUIRE(fmt::format("{}", Color{0}) == "0");

  REQUIRE(fmt::format(FMT_STRING("{}"), Color::RED) == "red");
  REQUIRE(fmt::format(FMT_STRING("{}"), Color{0}) == "0");

  REQUIRE(fmt::format(FMT_COMPILE("{}"), Color::RED) == "red");
  REQUIRE(fmt::format(FMT_COMPILE("{}"), Color{0}) == "0");
}
Neargye commented 4 months ago

Thanks!