fmtlib.fmt
importA modern formatting library for C++, exposed as C++23 module fmt
import fmt;
mcpp add fmtlib.fmt@12.2.0
Usage
From this repository's own test project — built and run by CI, not written for the website.
// Behavioral test: consume {fmt}'s compiled implementation through the C++23
// module `fmt` (`import fmt;`, no #include) and assert the results. Exercises
// src/format.cc via the module unit's tail includes — not just header inlines.
// Returns non-zero on any mismatch.
import std;
import fmt;
int main() {
std::string a = fmt::format("{} + {} = {}", 2, 3, 2 + 3);
std::string b = fmt::format("{:08.3f}", 3.14159);
std::string c = fmt::format("{0}-{1}-{0}", "x", "y");
std::string d = fmt::format("{:#x}", 255);
bool ok = a == "2 + 3 = 5"
&& b == "0003.142"
&& c == "x-y-x"
&& d == "0xff";
return ok ? 0 : 1;
}
tests/examples/fmtlib.fmt/tests/format_test.cpp · project tests/examples/fmtlib.fmt
Build
- modules
fmt- targets
fmt (lib)- language
c++23- import std
- yes
- include dirs
*/include, */src
Sources (1)
mcpp_generated/fmt_module.cppm
Generated files
mcpp_generated/fmt_module.cppm
Versions
| Version | Platforms | Mirrors | sha256 |
|---|---|---|---|
12.2.0 latest |
LinuxWindowsmacOS | source | 8b852bb5aa6e… |