Cantera 2.6.0

fmt.h
Go to the documentation of this file.
1//! @file fmt.h Wrapper for either system-installed or local headers for fmt
2#ifndef CT_FMT_H
3#define CT_FMT_H
4#include "ct_defs.h"
5
6//! Do not use the fmt macro from fmtlib because it shadows a function of
7//! the same name in kinetics/Group.h
8#define FMT_NO_FMT_STRING_ALIAS
9
10//! Versions 6.2.0 and 6.2.1 of fmtlib do not include this define before they
11//! include windows.h, breaking builds on Windows. Fixed in fmtlib 7.0.0 and
12//! newer. https://github.com/fmtlib/fmt/pull/1616
13#if defined(_WIN32) && !defined(NOMINMAX)
14#define NOMINMAX
15#endif
16#if CT_USE_SYSTEM_FMT
17 #include "fmt/format.h"
18 #if defined(FMT_VERSION) && FMT_VERSION >= 40000
19 #include "fmt/printf.h"
20 #endif
21 #include "fmt/ostream.h"
22#else
23 #include "cantera/ext/fmt/format.h"
24 #if defined(FMT_VERSION) && FMT_VERSION >= 40000
25 #include "cantera/ext/fmt/printf.h"
26 #endif
27 #include "cantera/ext/fmt/ostream.h"
28#endif
29
30#if !defined(FMT_VERSION) || FMT_VERSION < 50000
31 namespace fmt {
32 using memory_buffer = MemoryWriter;
33}
34 template <typename... Args>
35 void format_to(fmt::memory_buffer& b, Args... args) {
36 b.write(args...);
37}
38 inline std::string to_string(fmt::memory_buffer& b) {
39 return b.str();
40}
41#endif
42
43#if !defined(FMT_VERSION) || FMT_VERSION < 80000
44 template <typename... Args>
45 void fmt_append(fmt::memory_buffer& b, Args... args) {
46 format_to(b, args...);
47}
48#else
49 template <typename... Args>
50 void fmt_append(fmt::memory_buffer& b, Args... args) {
51 format_to(fmt::appender(b), args...);
52}
53#endif
54
55#endif
ct_defs.h
This file contains definitions of constants, types and terms that are used in internal routines and a...
fmt
Versions 6.2.0 and 6.2.1 of fmtlib do not include this define before they include windows....
Definition: fmt.h:31