From 3be3f7dad5291aa53c633e3043768d7527e54148 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 26 May 2018 22:08:07 -0400 Subject: [PATCH] Make updates for libfmt 5.0.0 backwards compatible --- include/cantera/base/fmt.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/cantera/base/fmt.h b/include/cantera/base/fmt.h index 7cdb9d67b..211fe4e98 100644 --- a/include/cantera/base/fmt.h +++ b/include/cantera/base/fmt.h @@ -1,4 +1,6 @@ //! @file fmt.h Wrapper for either system-installed or local headers for fmt +#ifndef CT_FMT_H +#define CT_FMT_H #include "ct_defs.h" //! Do not use the fmt macro from fmtlib because it shadows a function of @@ -18,3 +20,19 @@ #endif #include "cantera/ext/fmt/ostream.h" #endif + +#if !defined(FMT_VERSION) || FMT_VERSION < 50000 +namespace fmt { +using memory_buffer = MemoryWriter; +} +template +void format_to(fmt::memory_buffer& b, Args... args) { + b.write(args...); +} +inline std::string to_string(fmt::memory_buffer& b) { + return b.str(); +} + +#endif + +#endif