Skip to content

Commit 2e6e8bf

Browse files
Support fmt and std::format in C++20 module (#394)
1 parent 341521b commit 2e6e8bf

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

module/magic_enum.cppm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
module;
22

33
#include <version>
4+
#if __has_include(<fmt/format.h>)
5+
#include <fmt/format.h>
6+
#endif
47
#ifndef MAGIC_ENUM_USE_STD_MODULE
8+
#if defined(__cpp_lib_format)
9+
#include <format>
10+
#endif
511
#include <magic_enum/magic_enum_all.hpp>
612
#endif
713

@@ -85,3 +91,9 @@ export namespace std {
8591
using std::formatter;
8692
}
8793
#endif
94+
95+
#if defined(FMT_VERSION)
96+
export namespace fmt {
97+
using fmt::formatter;
98+
}
99+
#endif

0 commit comments

Comments
 (0)