forked from ruslo/hunter
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bfdf60
commit 962c5e8
Showing
3 changed files
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
#include <fmt/format.h> | ||
#include <fmt/core.h> | ||
#include <fmt/core.h> // The core API should be enough for the example below. The full format API is fmt/format.h | ||
|
||
int main() { | ||
fmt::print("Hello world\nThis is fmt(ex-cppformat)\n"); | ||
std::string as_string = fmt::format("The answer is {}", 42); | ||
fmt::memory_buffer buf; | ||
format_to(buf, "{}\nThe previous line and this message were bufferred in memory", as_string); | ||
auto buf = fmt::memory_buffer(); | ||
fmt::format_to(std::back_inserter(buf), "{}\nThe previous line and this message were bufferred in memory", as_string); | ||
fmt::print(stderr, "{}\nAnd then were printed to stderr\n", buf.data()); | ||
fmt::print("Fmt supports many nice features, see {url} for details\n", fmt::arg("url", "https://github.com/fmtlib/fmt")); | ||
} |