Commit 5afb5dc7 authored by gabime's avatar gabime

Changed clang formatting for templates

parent f4ce52d2
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "g2logworker.h" #include "g2logworker.h"
using namespace std; using namespace std;
template <typename T> std::string format(const T &value); template<typename T> std::string format(const T &value);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace utils { namespace utils {
template <typename T> inline std::string format(const T &value) template<typename T> inline std::string format(const T &value)
{ {
static std::locale loc(""); static std::locale loc("");
std::stringstream ss; std::stringstream ss;
...@@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value) ...@@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value)
return ss.str(); return ss.str();
} }
template <> inline std::string format(const double &value) template<> inline std::string format(const double &value)
{ {
static std::locale loc(""); static std::locale loc("");
std::stringstream ss; std::stringstream ss;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace utils { namespace utils {
template <typename T> inline std::string format(const T &value) template<typename T> inline std::string format(const T &value)
{ {
static std::locale loc(""); static std::locale loc("");
std::stringstream ss; std::stringstream ss;
...@@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value) ...@@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value)
return ss.str(); return ss.str();
} }
template <> inline std::string format(const double &value) template<> inline std::string format(const double &value)
{ {
static std::locale loc(""); static std::locale loc("");
std::stringstream ss; std::stringstream ss;
......
...@@ -24,6 +24,12 @@ void err_handler_example(); ...@@ -24,6 +24,12 @@ void err_handler_example();
namespace spd = spdlog; namespace spd = spdlog;
int main(int, char *[]) int main(int, char *[])
{ {
fmt::MemoryWriter w;
w.write("HELLO", 10);
std::string s(w.data(), w.size());
std::cout << s << std::endl;
return 0;
try try
{ {
// Console logger with color // Console logger with color
...@@ -133,7 +139,7 @@ void android_example() ...@@ -133,7 +139,7 @@ void android_example()
struct my_type struct my_type
{ {
int i; int i;
template <typename OStream> friend OStream &operator<<(OStream &os, const my_type &c) template<typename OStream> friend OStream &operator<<(OStream &os, const my_type &c)
{ {
return os << "[my_type i=" << c.i << "]"; return os << "[my_type i=" << c.i << "]";
} }
......
...@@ -133,7 +133,7 @@ void android_example() ...@@ -133,7 +133,7 @@ void android_example()
struct my_type struct my_type
{ {
int i; int i;
template <typename OStream> friend OStream &operator<<(OStream &os, const my_type &c) template<typename OStream> friend OStream &operator<<(OStream &os, const my_type &c)
{ {
return os << "[my_type i=" << c.i << "]"; return os << "[my_type i=" << c.i << "]";
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace utils { namespace utils {
template <typename T> inline std::string format(const T &value) template<typename T> inline std::string format(const T &value)
{ {
static std::locale loc(""); static std::locale loc("");
std::stringstream ss; std::stringstream ss;
...@@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value) ...@@ -20,7 +20,7 @@ template <typename T> inline std::string format(const T &value)
return ss.str(); return ss.str();
} }
template <> inline std::string format(const double &value) template<> inline std::string format(const double &value)
{ {
static std::locale loc(""); static std::locale loc("");
std::stringstream ss; std::stringstream ss;
......
...@@ -32,7 +32,7 @@ class async_log_helper; ...@@ -32,7 +32,7 @@ class async_log_helper;
class async_logger SPDLOG_FINAL : public logger class async_logger SPDLOG_FINAL : public logger
{ {
public: public:
template <class It> template<class It>
async_logger(const std::string &logger_name, const It &begin, const It &end, size_t queue_size, async_logger(const std::string &logger_name, const It &begin, const It &end, size_t queue_size,
const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
const std::function<void()> &worker_warmup_cb = nullptr, const std::function<void()> &worker_warmup_cb = nullptr,
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
template <class It> template<class It>
inline spdlog::async_logger::async_logger(const std::string &logger_name, const It &begin, const It &end, size_t queue_size, inline spdlog::async_logger::async_logger(const std::string &logger_name, const It &begin, const It &end, size_t queue_size,
const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb, const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb,
const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb) const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
// create logger with given name, sinks and the default pattern formatter // create logger with given name, sinks and the default pattern formatter
// all other ctors will call this one // all other ctors will call this one
template <class It> template<class It>
inline spdlog::logger::logger(std::string logger_name, const It &begin, const It &end) inline spdlog::logger::logger(std::string logger_name, const It &begin, const It &end)
: _name(std::move(logger_name)) : _name(std::move(logger_name))
, _sinks(begin, end) , _sinks(begin, end)
...@@ -50,7 +50,7 @@ inline void spdlog::logger::set_pattern(const std::string &pattern, pattern_time ...@@ -50,7 +50,7 @@ inline void spdlog::logger::set_pattern(const std::string &pattern, pattern_time
_set_pattern(pattern, pattern_time); _set_pattern(pattern, pattern_time);
} }
template <typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const char *fmt, const Args &... args) template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const char *fmt, const Args &... args)
{ {
if (!should_log(lvl)) if (!should_log(lvl))
return; return;
...@@ -77,7 +77,7 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv ...@@ -77,7 +77,7 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv
} }
} }
template <typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const char *msg) template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const char *msg)
{ {
if (!should_log(lvl)) if (!should_log(lvl))
return; return;
...@@ -98,7 +98,7 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv ...@@ -98,7 +98,7 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv
} }
} }
template <typename T> inline void spdlog::logger::log(level::level_enum lvl, const T &msg) template<typename T> inline void spdlog::logger::log(level::level_enum lvl, const T &msg)
{ {
if (!should_log(lvl)) if (!should_log(lvl))
return; return;
...@@ -119,62 +119,62 @@ template <typename T> inline void spdlog::logger::log(level::level_enum lvl, con ...@@ -119,62 +119,62 @@ template <typename T> inline void spdlog::logger::log(level::level_enum lvl, con
} }
} }
template <typename Arg1, typename... Args> inline void spdlog::logger::trace(const char *fmt, const Arg1 &arg1, const Args &... args) template<typename Arg1, typename... Args> inline void spdlog::logger::trace(const char *fmt, const Arg1 &arg1, const Args &... args)
{ {
log(level::trace, fmt, arg1, args...); log(level::trace, fmt, arg1, args...);
} }
template <typename Arg1, typename... Args> inline void spdlog::logger::debug(const char *fmt, const Arg1 &arg1, const Args &... args) template<typename Arg1, typename... Args> inline void spdlog::logger::debug(const char *fmt, const Arg1 &arg1, const Args &... args)
{ {
log(level::debug, fmt, arg1, args...); log(level::debug, fmt, arg1, args...);
} }
template <typename Arg1, typename... Args> inline void spdlog::logger::info(const char *fmt, const Arg1 &arg1, const Args &... args) template<typename Arg1, typename... Args> inline void spdlog::logger::info(const char *fmt, const Arg1 &arg1, const Args &... args)
{ {
log(level::info, fmt, arg1, args...); log(level::info, fmt, arg1, args...);
} }
template <typename Arg1, typename... Args> inline void spdlog::logger::warn(const char *fmt, const Arg1 &arg1, const Args &... args) template<typename Arg1, typename... Args> inline void spdlog::logger::warn(const char *fmt, const Arg1 &arg1, const Args &... args)
{ {
log(level::warn, fmt, arg1, args...); log(level::warn, fmt, arg1, args...);
} }
template <typename Arg1, typename... Args> inline void spdlog::logger::error(const char *fmt, const Arg1 &arg1, const Args &... args) template<typename Arg1, typename... Args> inline void spdlog::logger::error(const char *fmt, const Arg1 &arg1, const Args &... args)
{ {
log(level::err, fmt, arg1, args...); log(level::err, fmt, arg1, args...);
} }
template <typename Arg1, typename... Args> inline void spdlog::logger::critical(const char *fmt, const Arg1 &arg1, const Args &... args) template<typename Arg1, typename... Args> inline void spdlog::logger::critical(const char *fmt, const Arg1 &arg1, const Args &... args)
{ {
log(level::critical, fmt, arg1, args...); log(level::critical, fmt, arg1, args...);
} }
template <typename T> inline void spdlog::logger::trace(const T &msg) template<typename T> inline void spdlog::logger::trace(const T &msg)
{ {
log(level::trace, msg); log(level::trace, msg);
} }
template <typename T> inline void spdlog::logger::debug(const T &msg) template<typename T> inline void spdlog::logger::debug(const T &msg)
{ {
log(level::debug, msg); log(level::debug, msg);
} }
template <typename T> inline void spdlog::logger::info(const T &msg) template<typename T> inline void spdlog::logger::info(const T &msg)
{ {
log(level::info, msg); log(level::info, msg);
} }
template <typename T> inline void spdlog::logger::warn(const T &msg) template<typename T> inline void spdlog::logger::warn(const T &msg)
{ {
log(level::warn, msg); log(level::warn, msg);
} }
template <typename T> inline void spdlog::logger::error(const T &msg) template<typename T> inline void spdlog::logger::error(const T &msg)
{ {
log(level::err, msg); log(level::err, msg);
} }
template <typename T> inline void spdlog::logger::critical(const T &msg) template<typename T> inline void spdlog::logger::critical(const T &msg)
{ {
log(level::critical, msg); log(level::critical, msg);
} }
...@@ -183,14 +183,14 @@ template <typename T> inline void spdlog::logger::critical(const T &msg) ...@@ -183,14 +183,14 @@ template <typename T> inline void spdlog::logger::critical(const T &msg)
#include <codecvt> #include <codecvt>
#include <locale> #include <locale>
template <typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *msg) template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *msg)
{ {
std::wstring_convert<std::codecvt_utf8<wchar_t>> conv; std::wstring_convert<std::codecvt_utf8<wchar_t>> conv;
log(lvl, conv.to_bytes(msg)); log(lvl, conv.to_bytes(msg));
} }
template <typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *fmt, const Args &... args) template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl, const wchar_t *fmt, const Args &... args)
{ {
fmt::WMemoryWriter wWriter; fmt::WMemoryWriter wWriter;
...@@ -198,32 +198,32 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv ...@@ -198,32 +198,32 @@ template <typename... Args> inline void spdlog::logger::log(level::level_enum lv
log(lvl, wWriter.c_str()); log(lvl, wWriter.c_str());
} }
template <typename... Args> inline void spdlog::logger::trace(const wchar_t *fmt, const Args &... args) template<typename... Args> inline void spdlog::logger::trace(const wchar_t *fmt, const Args &... args)
{ {
log(level::trace, fmt, args...); log(level::trace, fmt, args...);
} }
template <typename... Args> inline void spdlog::logger::debug(const wchar_t *fmt, const Args &... args) template<typename... Args> inline void spdlog::logger::debug(const wchar_t *fmt, const Args &... args)
{ {
log(level::debug, fmt, args...); log(level::debug, fmt, args...);
} }
template <typename... Args> inline void spdlog::logger::info(const wchar_t *fmt, const Args &... args) template<typename... Args> inline void spdlog::logger::info(const wchar_t *fmt, const Args &... args)
{ {
log(level::info, fmt, args...); log(level::info, fmt, args...);
} }
template <typename... Args> inline void spdlog::logger::warn(const wchar_t *fmt, const Args &... args) template<typename... Args> inline void spdlog::logger::warn(const wchar_t *fmt, const Args &... args)
{ {
log(level::warn, fmt, args...); log(level::warn, fmt, args...);
} }
template <typename... Args> inline void spdlog::logger::error(const wchar_t *fmt, const Args &... args) template<typename... Args> inline void spdlog::logger::error(const wchar_t *fmt, const Args &... args)
{ {
log(level::err, fmt, args...); log(level::err, fmt, args...);
} }
template <typename... Args> inline void spdlog::logger::critical(const wchar_t *fmt, const Args &... args) template<typename... Args> inline void spdlog::logger::critical(const wchar_t *fmt, const Args &... args)
{ {
log(level::critical, fmt, args...); log(level::critical, fmt, args...);
} }
......
...@@ -50,7 +50,7 @@ Distributed under the MIT License (http://opensource.org/licenses/MIT) ...@@ -50,7 +50,7 @@ Distributed under the MIT License (http://opensource.org/licenses/MIT)
namespace spdlog { namespace details { namespace spdlog { namespace details {
template <typename T> class mpmc_bounded_queue template<typename T> class mpmc_bounded_queue
{ {
public: public:
using item_type = T; using item_type = T;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <unordered_map> #include <unordered_map>
namespace spdlog { namespace details { namespace spdlog { namespace details {
template <class Mutex> class registry_t template<class Mutex> class registry_t
{ {
public: public:
registry_t<Mutex>(const registry_t<Mutex> &) = delete; registry_t<Mutex>(const registry_t<Mutex> &) = delete;
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
return found == _loggers.end() ? nullptr : found->second; return found == _loggers.end() ? nullptr : found->second;
} }
template <class It> std::shared_ptr<logger> create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end) template<class It> std::shared_ptr<logger> create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end)
{ {
std::lock_guard<Mutex> lock(_mutex); std::lock_guard<Mutex> lock(_mutex);
throw_if_exists(logger_name); throw_if_exists(logger_name);
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
return new_logger; return new_logger;
} }
template <class It> template<class It>
std::shared_ptr<async_logger> create_async(const std::string &logger_name, size_t queue_size, std::shared_ptr<async_logger> create_async(const std::string &logger_name, size_t queue_size,
const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb, const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb,
const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb, const It &sinks_begin, const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb, const It &sinks_begin,
......
...@@ -190,14 +190,14 @@ inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_ ...@@ -190,14 +190,14 @@ inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_
return details::registry::instance().create(logger_name, sinks); return details::registry::instance().create(logger_name, sinks);
} }
template <typename Sink, typename... Args> template<typename Sink, typename... Args>
inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_name, Args... args) inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_name, Args... args)
{ {
sink_ptr sink = std::make_shared<Sink>(args...); sink_ptr sink = std::make_shared<Sink>(args...);
return details::registry::instance().create(logger_name, {sink}); return details::registry::instance().create(logger_name, {sink});
} }
template <class It> template<class It>
inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end) inline std::shared_ptr<spdlog::logger> spdlog::create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end)
{ {
return details::registry::instance().create(logger_name, sinks_begin, sinks_end); return details::registry::instance().create(logger_name, sinks_begin, sinks_end);
...@@ -221,7 +221,7 @@ inline std::shared_ptr<spdlog::logger> spdlog::create_async(const std::string &l ...@@ -221,7 +221,7 @@ inline std::shared_ptr<spdlog::logger> spdlog::create_async(const std::string &l
logger_name, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb, sinks); logger_name, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms, worker_teardown_cb, sinks);
} }
template <class It> template<class It>
inline std::shared_ptr<spdlog::logger> spdlog::create_async(const std::string &logger_name, const It &sinks_begin, const It &sinks_end, inline std::shared_ptr<spdlog::logger> spdlog::create_async(const std::string &logger_name, const It &sinks_begin, const It &sinks_end,
size_t queue_size, const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb, size_t queue_size, const async_overflow_policy overflow_policy, const std::function<void()> &worker_warmup_cb,
const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb) const std::chrono::milliseconds &flush_interval_ms, const std::function<void()> &worker_teardown_cb)
......
...@@ -345,8 +345,7 @@ typedef __int64 intmax_t; ...@@ -345,8 +345,7 @@ typedef __int64 intmax_t;
#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED) #if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED)
#include <intrin.h> // _BitScanReverse, _BitScanReverse64 #include <intrin.h> // _BitScanReverse, _BitScanReverse64
namespace fmt { namespace fmt { namespace internal {
namespace internal {
// avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning // avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning
#ifndef __clang__ #ifndef __clang__
#pragma intrinsic(_BitScanReverse) #pragma intrinsic(_BitScanReverse)
...@@ -392,8 +391,7 @@ inline uint32_t clzll(uint64_t x) ...@@ -392,8 +391,7 @@ inline uint32_t clzll(uint64_t x)
return 63 - r; return 63 - r;
} }
#define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n) #define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n)
} }} // namespace fmt::internal
} // namespace fmt
#endif #endif
namespace fmt { namespace internal { namespace fmt { namespace internal {
...@@ -436,7 +434,7 @@ inline DummyInt _isnan(...) ...@@ -436,7 +434,7 @@ inline DummyInt _isnan(...)
// A helper function to suppress bogus "conditional expression is constant" // A helper function to suppress bogus "conditional expression is constant"
// warnings. // warnings.
template <typename T> inline T const_check(T value) template<typename T> inline T const_check(T value)
{ {
return value; return value;
} }
...@@ -447,11 +445,11 @@ namespace std { ...@@ -447,11 +445,11 @@ namespace std {
// is used to resolve ambiguity between isinf and std::isinf in glibc: // is used to resolve ambiguity between isinf and std::isinf in glibc:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891
// and the same for isnan and signbit. // and the same for isnan and signbit.
template <> class numeric_limits<fmt::internal::DummyInt> : public std::numeric_limits<int> template<> class numeric_limits<fmt::internal::DummyInt> : public std::numeric_limits<int>
{ {
public: public:
// Portable version of isinf. // Portable version of isinf.
template <typename T> static bool isinfinity(T x) template<typename T> static bool isinfinity(T x)
{ {
using namespace fmt::internal; using namespace fmt::internal;
// The resolution "priority" is: // The resolution "priority" is:
...@@ -464,7 +462,7 @@ public: ...@@ -464,7 +462,7 @@ public:
} }
// Portable version of isnan. // Portable version of isnan.
template <typename T> static bool isnotanumber(T x) template<typename T> static bool isnotanumber(T x)
{ {
using namespace fmt::internal; using namespace fmt::internal;
if (const_check(sizeof(isnan(x)) == sizeof(bool) || sizeof(isnan(x)) == sizeof(int))) if (const_check(sizeof(isnan(x)) == sizeof(bool) || sizeof(isnan(x)) == sizeof(int)))
...@@ -505,18 +503,18 @@ FMT_GCC_EXTENSION typedef unsigned long long ULongLong; ...@@ -505,18 +503,18 @@ FMT_GCC_EXTENSION typedef unsigned long long ULongLong;
using std::move; using std::move;
#endif #endif
template <typename Char> class BasicWriter; template<typename Char> class BasicWriter;
typedef BasicWriter<char> Writer; typedef BasicWriter<char> Writer;
typedef BasicWriter<wchar_t> WWriter; typedef BasicWriter<wchar_t> WWriter;
template <typename Char> class ArgFormatter; template<typename Char> class ArgFormatter;
struct FormatSpec; struct FormatSpec;
template <typename Impl, typename Char, typename Spec = fmt::FormatSpec> class BasicPrintfArgFormatter; template<typename Impl, typename Char, typename Spec = fmt::FormatSpec> class BasicPrintfArgFormatter;
template <typename CharType, typename ArgFormatter = fmt::ArgFormatter<CharType>> class BasicFormatter; template<typename CharType, typename ArgFormatter = fmt::ArgFormatter<CharType>> class BasicFormatter;
/** /**
\rst \rst
...@@ -543,7 +541,7 @@ template <typename CharType, typename ArgFormatter = fmt::ArgFormatter<CharType> ...@@ -543,7 +541,7 @@ template <typename CharType, typename ArgFormatter = fmt::ArgFormatter<CharType>
format(std::string("{}"), 42); format(std::string("{}"), 42);
\endrst \endrst
*/ */
template <typename Char> class BasicStringRef template<typename Char> class BasicStringRef
{ {
private: private:
const Char *data_; const Char *data_;
...@@ -574,7 +572,7 @@ public: ...@@ -574,7 +572,7 @@ public:
Constructs a string reference from a ``std::basic_string`` object. Constructs a string reference from a ``std::basic_string`` object.
\endrst \endrst
*/ */
template <typename Allocator> template<typename Allocator>
BasicStringRef(const std::basic_string<Char, std::char_traits<Char>, Allocator> &s) BasicStringRef(const std::basic_string<Char, std::char_traits<Char>, Allocator> &s)
: data_(s.c_str()) : data_(s.c_str())
, size_(s.size()) , size_(s.size())
...@@ -690,7 +688,7 @@ typedef BasicStringRef<wchar_t> WStringRef; ...@@ -690,7 +688,7 @@ typedef BasicStringRef<wchar_t> WStringRef;
format(std::string("{}"), 42); format(std::string("{}"), 42);
\endrst \endrst
*/ */
template <typename Char> class BasicCStringRef template<typename Char> class BasicCStringRef
{ {
private: private:
const Char *data_; const Char *data_;
...@@ -707,7 +705,7 @@ public: ...@@ -707,7 +705,7 @@ public:
Constructs a string reference from a ``std::basic_string`` object. Constructs a string reference from a ``std::basic_string`` object.
\endrst \endrst
*/ */
template <typename Allocator> template<typename Allocator>
BasicCStringRef(const std::basic_string<Char, std::char_traits<Char>, Allocator> &s) BasicCStringRef(const std::basic_string<Char, std::char_traits<Char>, Allocator> &s)
: data_(s.c_str()) : data_(s.c_str())
{ {
...@@ -741,13 +739,13 @@ public: ...@@ -741,13 +739,13 @@ public:
namespace internal { namespace internal {
// MakeUnsigned<T>::Type gives an unsigned type corresponding to integer type T. // MakeUnsigned<T>::Type gives an unsigned type corresponding to integer type T.
template <typename T> struct MakeUnsigned template<typename T> struct MakeUnsigned
{ {
typedef T Type; typedef T Type;
}; };
#define FMT_SPECIALIZE_MAKE_UNSIGNED(T, U) \ #define FMT_SPECIALIZE_MAKE_UNSIGNED(T, U) \
template <> struct MakeUnsigned<T> \ template<> struct MakeUnsigned<T> \
{ \ { \
typedef U Type; \ typedef U Type; \
} }
...@@ -760,7 +758,7 @@ FMT_SPECIALIZE_MAKE_UNSIGNED(long, unsigned long); ...@@ -760,7 +758,7 @@ FMT_SPECIALIZE_MAKE_UNSIGNED(long, unsigned long);
FMT_SPECIALIZE_MAKE_UNSIGNED(LongLong, ULongLong); FMT_SPECIALIZE_MAKE_UNSIGNED(LongLong, ULongLong);
// Casts nonnegative integer to unsigned. // Casts nonnegative integer to unsigned.
template <typename Int> inline typename MakeUnsigned<Int>::Type to_unsigned(Int value) template<typename Int> inline typename MakeUnsigned<Int>::Type to_unsigned(Int value)
{ {
FMT_ASSERT(value >= 0, "negative value"); FMT_ASSERT(value >= 0, "negative value");
return static_cast<typename MakeUnsigned<Int>::Type>(value); return static_cast<typename MakeUnsigned<Int>::Type>(value);
...@@ -775,12 +773,12 @@ enum ...@@ -775,12 +773,12 @@ enum
#if FMT_SECURE_SCL #if FMT_SECURE_SCL
// Use checked iterator to avoid warnings on MSVC. // Use checked iterator to avoid warnings on MSVC.
template <typename T> inline stdext::checked_array_iterator<T *> make_ptr(T *ptr, std::size_t size) template<typename T> inline stdext::checked_array_iterator<T *> make_ptr(T *ptr, std::size_t size)
{ {
return stdext::checked_array_iterator<T *>(ptr, size); return stdext::checked_array_iterator<T *>(ptr, size);
} }
#else #else
template <typename T> inline T *make_ptr(T *ptr, std::size_t) template<typename T> inline T *make_ptr(T *ptr, std::size_t)
{ {
return ptr; return ptr;
} }
...@@ -792,7 +790,7 @@ template <typename T> inline T *make_ptr(T *ptr, std::size_t) ...@@ -792,7 +790,7 @@ template <typename T> inline T *make_ptr(T *ptr, std::size_t)
A buffer supporting a subset of ``std::vector``'s operations. A buffer supporting a subset of ``std::vector``'s operations.
\endrst \endrst
*/ */
template <typename T> class Buffer template<typename T> class Buffer
{ {
private: private:
FMT_DISALLOW_COPY_AND_ASSIGN(Buffer); FMT_DISALLOW_COPY_AND_ASSIGN(Buffer);
...@@ -866,7 +864,7 @@ public: ...@@ -866,7 +864,7 @@ public:
} }
/** Appends data to the end of the buffer. */ /** Appends data to the end of the buffer. */
template <typename U> void append(const U *begin, const U *end); template<typename U> void append(const U *begin, const U *end);
T &operator[](std::size_t index) T &operator[](std::size_t index)
{ {
...@@ -878,7 +876,7 @@ public: ...@@ -878,7 +876,7 @@ public:
} }
}; };
template <typename T> template <typename U> void Buffer<T>::append(const U *begin, const U *end) template<typename T> template<typename U> void Buffer<T>::append(const U *begin, const U *end)
{ {
FMT_ASSERT(end >= begin, "negative value"); FMT_ASSERT(end >= begin, "negative value");
std::size_t new_size = size_ + static_cast<std::size_t>(end - begin); std::size_t new_size = size_ + static_cast<std::size_t>(end - begin);
...@@ -892,7 +890,7 @@ namespace internal { ...@@ -892,7 +890,7 @@ namespace internal {
// A memory buffer for trivially copyable/constructible types with the first // A memory buffer for trivially copyable/constructible types with the first
// SIZE elements stored in the object itself. // SIZE elements stored in the object itself.
template <typename T, std::size_t SIZE, typename Allocator = std::allocator<T>> class MemoryBuffer : private Allocator, public Buffer<T> template<typename T, std::size_t SIZE, typename Allocator = std::allocator<T>> class MemoryBuffer : private Allocator, public Buffer<T>
{ {
private: private:
T data_[SIZE]; T data_[SIZE];
...@@ -963,7 +961,7 @@ public: ...@@ -963,7 +961,7 @@ public:
} }
}; };
template <typename T, std::size_t SIZE, typename Allocator> void MemoryBuffer<T, SIZE, Allocator>::grow(std::size_t size) template<typename T, std::size_t SIZE, typename Allocator> void MemoryBuffer<T, SIZE, Allocator>::grow(std::size_t size)
{ {
std::size_t new_capacity = this->capacity_ + this->capacity_ / 2; std::size_t new_capacity = this->capacity_ + this->capacity_ / 2;
if (size > new_capacity) if (size > new_capacity)
...@@ -987,7 +985,7 @@ template <typename T, std::size_t SIZE, typename Allocator> void MemoryBuffer<T, ...@@ -987,7 +985,7 @@ template <typename T, std::size_t SIZE, typename Allocator> void MemoryBuffer<T,
} }
// A fixed-size buffer. // A fixed-size buffer.
template <typename Char> class FixedBuffer : public fmt::Buffer<Char> template<typename Char> class FixedBuffer : public fmt::Buffer<Char>
{ {
public: public:
FixedBuffer(Char *array, std::size_t size) FixedBuffer(Char *array, std::size_t size)
...@@ -999,7 +997,7 @@ protected: ...@@ -999,7 +997,7 @@ protected:
FMT_API void grow(std::size_t size) FMT_OVERRIDE; FMT_API void grow(std::size_t size) FMT_OVERRIDE;
}; };
template <typename Char> class BasicCharTraits template<typename Char> class BasicCharTraits
{ {
public: public:
#if FMT_SECURE_SCL #if FMT_SECURE_SCL
...@@ -1013,9 +1011,9 @@ public: ...@@ -1013,9 +1011,9 @@ public:
} }
}; };
template <typename Char> class CharTraits; template<typename Char> class CharTraits;
template <> class CharTraits<char> : public BasicCharTraits<char> template<> class CharTraits<char> : public BasicCharTraits<char>
{ {
private: private:
// Conversion from wchar_t to char is not allowed. // Conversion from wchar_t to char is not allowed.
...@@ -1028,7 +1026,7 @@ public: ...@@ -1028,7 +1026,7 @@ public:
} }
// Formats a floating-point number. // Formats a floating-point number.
template <typename T> template<typename T>
FMT_API static int format_float(char *buffer, std::size_t size, const char *format, unsigned width, int precision, T value); FMT_API static int format_float(char *buffer, std::size_t size, const char *format, unsigned width, int precision, T value);
}; };
...@@ -1039,7 +1037,7 @@ extern template int CharTraits<char>::format_float<long double>( ...@@ -1039,7 +1037,7 @@ extern template int CharTraits<char>::format_float<long double>(
char *buffer, std::size_t size, const char *format, unsigned width, int precision, long double value); char *buffer, std::size_t size, const char *format, unsigned width, int precision, long double value);
#endif #endif
template <> class CharTraits<wchar_t> : public BasicCharTraits<wchar_t> template<> class CharTraits<wchar_t> : public BasicCharTraits<wchar_t>
{ {
public: public:
static wchar_t convert(char value) static wchar_t convert(char value)
...@@ -1051,7 +1049,7 @@ public: ...@@ -1051,7 +1049,7 @@ public:
return value; return value;
} }
template <typename T> template<typename T>
FMT_API static int format_float(wchar_t *buffer, std::size_t size, const wchar_t *format, unsigned width, int precision, T value); FMT_API static int format_float(wchar_t *buffer, std::size_t size, const wchar_t *format, unsigned width, int precision, T value);
}; };
...@@ -1063,17 +1061,17 @@ extern template int CharTraits<wchar_t>::format_float<long double>( ...@@ -1063,17 +1061,17 @@ extern template int CharTraits<wchar_t>::format_float<long double>(
#endif #endif
// Checks if a number is negative - used to avoid warnings. // Checks if a number is negative - used to avoid warnings.
template <bool IsSigned> struct SignChecker template<bool IsSigned> struct SignChecker
{ {
template <typename T> static bool is_negative(T value) template<typename T> static bool is_negative(T value)
{ {
return value < 0; return value < 0;
} }
}; };
template <> struct SignChecker<false> template<> struct SignChecker<false>
{ {
template <typename T> static bool is_negative(T) template<typename T> static bool is_negative(T)
{ {
return false; return false;
} }
...@@ -1081,23 +1079,23 @@ template <> struct SignChecker<false> ...@@ -1081,23 +1079,23 @@ template <> struct SignChecker<false>
// Returns true if value is negative, false otherwise. // Returns true if value is negative, false otherwise.
// Same as (value < 0) but doesn't produce warnings if T is an unsigned type. // Same as (value < 0) but doesn't produce warnings if T is an unsigned type.
template <typename T> inline bool is_negative(T value) template<typename T> inline bool is_negative(T value)
{ {
return SignChecker<std::numeric_limits<T>::is_signed>::is_negative(value); return SignChecker<std::numeric_limits<T>::is_signed>::is_negative(value);
} }
// Selects uint32_t if FitsIn32Bits is true, uint64_t otherwise. // Selects uint32_t if FitsIn32Bits is true, uint64_t otherwise.
template <bool FitsIn32Bits> struct TypeSelector template<bool FitsIn32Bits> struct TypeSelector
{ {
typedef uint32_t Type; typedef uint32_t Type;
}; };
template <> struct TypeSelector<false> template<> struct TypeSelector<false>
{ {
typedef uint64_t Type; typedef uint64_t Type;
}; };
template <typename T> struct IntTraits template<typename T> struct IntTraits
{ {
// Smallest of uint32_t and uint64_t that is large enough to represent // Smallest of uint32_t and uint64_t that is large enough to represent
// all values of T. // all values of T.
...@@ -1108,7 +1106,7 @@ FMT_API FMT_NORETURN void report_unknown_type(char code, const char *type); ...@@ -1108,7 +1106,7 @@ FMT_API FMT_NORETURN void report_unknown_type(char code, const char *type);
// Static data is placed in this class template to allow header-only // Static data is placed in this class template to allow header-only
// configuration. // configuration.
template <typename T = void> struct FMT_API BasicData template<typename T = void> struct FMT_API BasicData
{ {
static const uint32_t POWERS_OF_10_32[]; static const uint32_t POWERS_OF_10_32[];
static const uint64_t POWERS_OF_10_64[]; static const uint64_t POWERS_OF_10_64[];
...@@ -1167,7 +1165,7 @@ inline unsigned count_digits(uint32_t n) ...@@ -1167,7 +1165,7 @@ inline unsigned count_digits(uint32_t n)
// A functor that doesn't add a thousands separator. // A functor that doesn't add a thousands separator.
struct NoThousandsSep struct NoThousandsSep
{ {
template <typename Char> void operator()(Char *) {} template<typename Char> void operator()(Char *) {}
}; };
// A functor that adds a thousands separator. // A functor that adds a thousands separator.
...@@ -1186,7 +1184,7 @@ public: ...@@ -1186,7 +1184,7 @@ public:
{ {
} }
template <typename Char> void operator()(Char *&buffer) template<typename Char> void operator()(Char *&buffer)
{ {
if (++digit_index_ % 3 != 0) if (++digit_index_ % 3 != 0)
return; return;
...@@ -1198,7 +1196,7 @@ public: ...@@ -1198,7 +1196,7 @@ public:
// Formats a decimal unsigned integer value writing into buffer. // Formats a decimal unsigned integer value writing into buffer.
// thousands_sep is a functor that is called after writing each char to // thousands_sep is a functor that is called after writing each char to
// add a thousands separator if necessary. // add a thousands separator if necessary.
template <typename UInt, typename Char, typename ThousandsSep> template<typename UInt, typename Char, typename ThousandsSep>
inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, ThousandsSep thousands_sep) inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, ThousandsSep thousands_sep)
{ {
buffer += num_digits; buffer += num_digits;
...@@ -1225,7 +1223,7 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, Thousa ...@@ -1225,7 +1223,7 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, Thousa
*--buffer = Data::DIGITS[index]; *--buffer = Data::DIGITS[index];
} }
template <typename UInt, typename Char> inline void format_decimal(Char *buffer, UInt value, unsigned num_digits) template<typename UInt, typename Char> inline void format_decimal(Char *buffer, UInt value, unsigned num_digits)
{ {
format_decimal(buffer, value, num_digits, NoThousandsSep()); format_decimal(buffer, value, num_digits, NoThousandsSep());
return; return;
...@@ -1306,7 +1304,7 @@ FMT_API void format_windows_error(fmt::Writer &out, int error_code, fmt::StringR ...@@ -1306,7 +1304,7 @@ FMT_API void format_windows_error(fmt::Writer &out, int error_code, fmt::StringR
// A formatting argument value. // A formatting argument value.
struct Value struct Value
{ {
template <typename Char> struct StringValue template<typename Char> struct StringValue
{ {
const Char *value; const Char *value;
std::size_t size; std::size_t size;
...@@ -1367,22 +1365,22 @@ struct Arg : Value ...@@ -1367,22 +1365,22 @@ struct Arg : Value
Type type; Type type;
}; };
template <typename Char> struct NamedArg; template<typename Char> struct NamedArg;
template <typename Char, typename T> struct NamedArgWithType; template<typename Char, typename T> struct NamedArgWithType;
template <typename T = void> struct Null template<typename T = void> struct Null
{ {
}; };
// A helper class template to enable or disable overloads taking wide // A helper class template to enable or disable overloads taking wide
// characters and strings in MakeValue. // characters and strings in MakeValue.
template <typename T, typename Char> struct WCharHelper template<typename T, typename Char> struct WCharHelper
{ {
typedef Null<T> Supported; typedef Null<T> Supported;
typedef T Unsupported; typedef T Unsupported;
}; };
template <typename T> struct WCharHelper<T, wchar_t> template<typename T> struct WCharHelper<T, wchar_t>
{ {
typedef T Supported; typedef T Supported;
typedef Null<T> Unsupported; typedef Null<T> Unsupported;
...@@ -1391,13 +1389,13 @@ template <typename T> struct WCharHelper<T, wchar_t> ...@@ -1391,13 +1389,13 @@ template <typename T> struct WCharHelper<T, wchar_t>
typedef char Yes[1]; typedef char Yes[1];
typedef char No[2]; typedef char No[2];
template <typename T> T &get(); template<typename T> T &get();
// These are non-members to workaround an overload resolution bug in bcc32. // These are non-members to workaround an overload resolution bug in bcc32.
Yes &convert(fmt::ULongLong); Yes &convert(fmt::ULongLong);
No &convert(...); No &convert(...);
template <typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl template<typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl
{ {
enum enum
{ {
...@@ -1405,7 +1403,7 @@ template <typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl ...@@ -1405,7 +1403,7 @@ template <typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl
}; };
}; };
template <typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl2 template<typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl2
{ {
enum enum
{ {
...@@ -1413,7 +1411,7 @@ template <typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl2 ...@@ -1413,7 +1411,7 @@ template <typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl2
}; };
}; };
template <typename T> struct ConvertToIntImpl2<T, true> template<typename T> struct ConvertToIntImpl2<T, true>
{ {
enum enum
{ {
...@@ -1422,7 +1420,7 @@ template <typename T> struct ConvertToIntImpl2<T, true> ...@@ -1422,7 +1420,7 @@ template <typename T> struct ConvertToIntImpl2<T, true>
}; };
}; };
template <typename T> struct ConvertToInt template<typename T> struct ConvertToInt
{ {
enum enum
{ {
...@@ -1435,7 +1433,7 @@ template <typename T> struct ConvertToInt ...@@ -1435,7 +1433,7 @@ template <typename T> struct ConvertToInt
}; };
#define FMT_DISABLE_CONVERSION_TO_INT(Type) \ #define FMT_DISABLE_CONVERSION_TO_INT(Type) \
template <> struct ConvertToInt<Type> \ template<> struct ConvertToInt<Type> \
{ \ { \
enum \ enum \
{ \ { \
...@@ -1448,27 +1446,27 @@ FMT_DISABLE_CONVERSION_TO_INT(float); ...@@ -1448,27 +1446,27 @@ FMT_DISABLE_CONVERSION_TO_INT(float);
FMT_DISABLE_CONVERSION_TO_INT(double); FMT_DISABLE_CONVERSION_TO_INT(double);
FMT_DISABLE_CONVERSION_TO_INT(long double); FMT_DISABLE_CONVERSION_TO_INT(long double);
template <bool B, class T = void> struct EnableIf template<bool B, class T = void> struct EnableIf
{ {
}; };
template <class T> struct EnableIf<true, T> template<class T> struct EnableIf<true, T>
{ {
typedef T type; typedef T type;
}; };
template <bool B, class T, class F> struct Conditional template<bool B, class T, class F> struct Conditional
{ {
typedef T type; typedef T type;
}; };
template <class T, class F> struct Conditional<false, T, F> template<class T, class F> struct Conditional<false, T, F>
{ {
typedef F type; typedef F type;
}; };
// For bcc32 which doesn't understand ! in template arguments. // For bcc32 which doesn't understand ! in template arguments.
template <bool> struct Not template<bool> struct Not
{ {
enum enum
{ {
...@@ -1476,7 +1474,7 @@ template <bool> struct Not ...@@ -1476,7 +1474,7 @@ template <bool> struct Not
}; };
}; };
template <> struct Not<false> template<> struct Not<false>
{ {
enum enum
{ {
...@@ -1484,7 +1482,7 @@ template <> struct Not<false> ...@@ -1484,7 +1482,7 @@ template <> struct Not<false>
}; };
}; };
template <typename T> struct FalseType template<typename T> struct FalseType
{ {
enum enum
{ {
...@@ -1492,7 +1490,7 @@ template <typename T> struct FalseType ...@@ -1492,7 +1490,7 @@ template <typename T> struct FalseType
}; };
}; };
template <typename T, T> struct LConvCheck template<typename T, T> struct LConvCheck
{ {
LConvCheck(int) {} LConvCheck(int) {}
}; };
...@@ -1500,7 +1498,7 @@ template <typename T, T> struct LConvCheck ...@@ -1500,7 +1498,7 @@ template <typename T, T> struct LConvCheck
// Returns the thousands separator for the current locale. // Returns the thousands separator for the current locale.
// We check if ``lconv`` contains ``thousands_sep`` because on Android // We check if ``lconv`` contains ``thousands_sep`` because on Android
// ``lconv`` is stubbed as an empty struct. // ``lconv`` is stubbed as an empty struct.
template <typename LConv> inline StringRef thousands_sep(LConv *lc, LConvCheck<char * LConv::*, &LConv::thousands_sep> = 0) template<typename LConv> inline StringRef thousands_sep(LConv *lc, LConvCheck<char * LConv::*, &LConv::thousands_sep> = 0)
{ {
return lc->thousands_sep; return lc->thousands_sep;
} }
...@@ -1529,7 +1527,7 @@ inline fmt::StringRef thousands_sep(...) ...@@ -1529,7 +1527,7 @@ inline fmt::StringRef thousands_sep(...)
#define FMT_STATIC_ASSERT(cond, message) typedef int FMT_CONCAT_(Assert, __LINE__)[(cond) ? 1 : -1] FMT_UNUSED #define FMT_STATIC_ASSERT(cond, message) typedef int FMT_CONCAT_(Assert, __LINE__)[(cond) ? 1 : -1] FMT_UNUSED
#endif #endif
template <typename Formatter> void format_arg(Formatter &, ...) template<typename Formatter> void format_arg(Formatter &, ...)
{ {
FMT_STATIC_ASSERT(FalseType<Formatter>::value, "Cannot format argument. To enable the use of ostream " FMT_STATIC_ASSERT(FalseType<Formatter>::value, "Cannot format argument. To enable the use of ostream "
"operator<< include fmt/ostream.h. Otherwise provide " "operator<< include fmt/ostream.h. Otherwise provide "
...@@ -1537,7 +1535,7 @@ template <typename Formatter> void format_arg(Formatter &, ...) ...@@ -1537,7 +1535,7 @@ template <typename Formatter> void format_arg(Formatter &, ...)
} }
// Makes an Arg object from any type. // Makes an Arg object from any type.
template <typename Formatter> class MakeValue : public Arg template<typename Formatter> class MakeValue : public Arg
{ {
public: public:
typedef typename Formatter::Char Char; typedef typename Formatter::Char Char;
...@@ -1548,8 +1546,8 @@ private: ...@@ -1548,8 +1546,8 @@ private:
// "void *" or "const void *". In particular, this forbids formatting // "void *" or "const void *". In particular, this forbids formatting
// of "[const] volatile char *" which is printed as bool by iostreams. // of "[const] volatile char *" which is printed as bool by iostreams.
// Do not implement! // Do not implement!
template <typename T> MakeValue(const T *value); template<typename T> MakeValue(const T *value);
template <typename T> MakeValue(T *value); template<typename T> MakeValue(T *value);
// The following methods are private to disallow formatting of wide // The following methods are private to disallow formatting of wide
// characters and strings into narrow strings as in // characters and strings into narrow strings as in
...@@ -1579,7 +1577,7 @@ private: ...@@ -1579,7 +1577,7 @@ private:
} }
// Formats an argument of a custom type, such as a user-defined class. // Formats an argument of a custom type, such as a user-defined class.
template <typename T> static void format_custom_arg(void *formatter, const void *arg, void *format_str_ptr) template<typename T> static void format_custom_arg(void *formatter, const void *arg, void *format_str_ptr)
{ {
format_arg(*static_cast<Formatter *>(formatter), *static_cast<const Char **>(format_str_ptr), *static_cast<const T *>(arg)); format_arg(*static_cast<Formatter *>(formatter), *static_cast<const Char **>(format_str_ptr), *static_cast<const T *>(arg));
} }
...@@ -1641,13 +1639,12 @@ public: ...@@ -1641,13 +1639,12 @@ public:
FMT_MAKE_VALUE(char, int_value, CHAR) FMT_MAKE_VALUE(char, int_value, CHAR)
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template <typename T, typename = typename std::enable_if<std::is_enum<T>::value && ConvertToInt<T>::value>::type> MakeValue(T value) template<typename T, typename = typename std::enable_if<std::is_enum<T>::value && ConvertToInt<T>::value>::type> MakeValue(T value)
{ {
int_value = value; int_value = value;
} }
template <typename T, typename = typename std::enable_if<std::is_enum<T>::value && ConvertToInt<T>::value>::type> template<typename T, typename = typename std::enable_if<std::is_enum<T>::value && ConvertToInt<T>::value>::type> static uint64_t type(T)
static uint64_t type(T)
{ {
return Arg::INT; return Arg::INT;
} }
...@@ -1708,39 +1705,39 @@ public: ...@@ -1708,39 +1705,39 @@ public:
FMT_MAKE_VALUE(void *, pointer, POINTER) FMT_MAKE_VALUE(void *, pointer, POINTER)
FMT_MAKE_VALUE(const void *, pointer, POINTER) FMT_MAKE_VALUE(const void *, pointer, POINTER)
template <typename T> MakeValue(const T &value, typename EnableIf<Not<ConvertToInt<T>::value>::value, int>::type = 0) template<typename T> MakeValue(const T &value, typename EnableIf<Not<ConvertToInt<T>::value>::value, int>::type = 0)
{ {
custom.value = &value; custom.value = &value;
custom.format = &format_custom_arg<T>; custom.format = &format_custom_arg<T>;
} }
template <typename T> static typename EnableIf<Not<ConvertToInt<T>::value>::value, uint64_t>::type type(const T &) template<typename T> static typename EnableIf<Not<ConvertToInt<T>::value>::value, uint64_t>::type type(const T &)
{ {
return Arg::CUSTOM; return Arg::CUSTOM;
} }
// Additional template param `Char_` is needed here because make_type always // Additional template param `Char_` is needed here because make_type always
// uses char. // uses char.
template <typename Char_> MakeValue(const NamedArg<Char_> &value) template<typename Char_> MakeValue(const NamedArg<Char_> &value)
{ {
pointer = &value; pointer = &value;
} }
template <typename Char_, typename T> MakeValue(const NamedArgWithType<Char_, T> &value) template<typename Char_, typename T> MakeValue(const NamedArgWithType<Char_, T> &value)
{ {
pointer = &value; pointer = &value;
} }
template <typename Char_> static uint64_t type(const NamedArg<Char_> &) template<typename Char_> static uint64_t type(const NamedArg<Char_> &)
{ {
return Arg::NAMED_ARG; return Arg::NAMED_ARG;
} }
template <typename Char_, typename T> static uint64_t type(const NamedArgWithType<Char_, T> &) template<typename Char_, typename T> static uint64_t type(const NamedArgWithType<Char_, T> &)
{ {
return Arg::NAMED_ARG; return Arg::NAMED_ARG;
} }
}; };
template <typename Formatter> class MakeArg : public Arg template<typename Formatter> class MakeArg : public Arg
{ {
public: public:
MakeArg() MakeArg()
...@@ -1748,7 +1745,7 @@ public: ...@@ -1748,7 +1745,7 @@ public:
type = Arg::NONE; type = Arg::NONE;
} }
template <typename T> template<typename T>
MakeArg(const T &value) MakeArg(const T &value)
: Arg(MakeValue<Formatter>(value)) : Arg(MakeValue<Formatter>(value))
{ {
...@@ -1756,11 +1753,11 @@ public: ...@@ -1756,11 +1753,11 @@ public:
} }
}; };
template <typename Char> struct NamedArg : Arg template<typename Char> struct NamedArg : Arg
{ {
BasicStringRef<Char> name; BasicStringRef<Char> name;
template <typename T> template<typename T>
NamedArg(BasicStringRef<Char> argname, const T &value) NamedArg(BasicStringRef<Char> argname, const T &value)
: Arg(MakeArg<BasicFormatter<Char>>(value)) : Arg(MakeArg<BasicFormatter<Char>>(value))
, name(argname) , name(argname)
...@@ -1768,7 +1765,7 @@ template <typename Char> struct NamedArg : Arg ...@@ -1768,7 +1765,7 @@ template <typename Char> struct NamedArg : Arg
} }
}; };
template <typename Char, typename T> struct NamedArgWithType : NamedArg<Char> template<typename Char, typename T> struct NamedArgWithType : NamedArg<Char>
{ {
NamedArgWithType(BasicStringRef<Char> argname, const T &value) NamedArgWithType(BasicStringRef<Char> argname, const T &value)
: NamedArg<Char>(argname, value) : NamedArg<Char>(argname, value)
...@@ -1790,7 +1787,7 @@ protected: ...@@ -1790,7 +1787,7 @@ protected:
FMT_API ~RuntimeError() FMT_DTOR_NOEXCEPT FMT_OVERRIDE; FMT_API ~RuntimeError() FMT_DTOR_NOEXCEPT FMT_OVERRIDE;
}; };
template <typename Char> class ArgMap; template<typename Char> class ArgMap;
} // namespace internal } // namespace internal
/** An argument list. */ /** An argument list. */
...@@ -1816,7 +1813,7 @@ private: ...@@ -1816,7 +1813,7 @@ private:
return type(types_, index); return type(types_, index);
} }
template <typename Char> friend class internal::ArgMap; template<typename Char> friend class internal::ArgMap;
public: public:
// Maximum number of arguments with packed types. // Maximum number of arguments with packed types.
...@@ -1910,7 +1907,7 @@ public: ...@@ -1910,7 +1907,7 @@ public:
}; };
\endrst \endrst
*/ */
template <typename Impl, typename Result> class ArgVisitor template<typename Impl, typename Result> class ArgVisitor
{ {
private: private:
typedef internal::Arg Arg; typedef internal::Arg Arg;
...@@ -1961,7 +1958,7 @@ public: ...@@ -1961,7 +1958,7 @@ public:
} }
/** Visits an argument of any integral type. **/ /** Visits an argument of any integral type. **/
template <typename T> Result visit_any_int(T) template<typename T> Result visit_any_int(T)
{ {
return FMT_DISPATCH(visit_unhandled_arg()); return FMT_DISPATCH(visit_unhandled_arg());
} }
...@@ -1979,7 +1976,7 @@ public: ...@@ -1979,7 +1976,7 @@ public:
} }
/** Visits a ``double`` or ``long double`` argument. **/ /** Visits a ``double`` or ``long double`` argument. **/
template <typename T> Result visit_any_double(T) template<typename T> Result visit_any_double(T)
{ {
return FMT_DISPATCH(visit_unhandled_arg()); return FMT_DISPATCH(visit_unhandled_arg());
} }
...@@ -2086,7 +2083,7 @@ struct EmptySpec ...@@ -2086,7 +2083,7 @@ struct EmptySpec
}; };
// A type specifier. // A type specifier.
template <char TYPE> struct TypeSpec : EmptySpec template<char TYPE> struct TypeSpec : EmptySpec
{ {
Alignment align() const Alignment align() const
{ {
...@@ -2165,7 +2162,7 @@ struct AlignSpec : WidthSpec ...@@ -2165,7 +2162,7 @@ struct AlignSpec : WidthSpec
}; };
// An alignment and type specifier. // An alignment and type specifier.
template <char TYPE> struct AlignTypeSpec : AlignSpec template<char TYPE> struct AlignTypeSpec : AlignSpec
{ {
AlignTypeSpec(unsigned width, wchar_t fill) AlignTypeSpec(unsigned width, wchar_t fill)
: AlignSpec(width, fill) : AlignSpec(width, fill)
...@@ -2220,7 +2217,7 @@ struct FormatSpec : AlignSpec ...@@ -2220,7 +2217,7 @@ struct FormatSpec : AlignSpec
}; };
// An integer format specifier. // An integer format specifier.
template <typename T, typename SpecT = TypeSpec<0>, typename Char = char> class IntFormatSpec : public SpecT template<typename T, typename SpecT = TypeSpec<0>, typename Char = char> class IntFormatSpec : public SpecT
{ {
private: private:
T value_; T value_;
...@@ -2239,13 +2236,13 @@ public: ...@@ -2239,13 +2236,13 @@ public:
}; };
// A string format specifier. // A string format specifier.
template <typename Char> class StrFormatSpec : public AlignSpec template<typename Char> class StrFormatSpec : public AlignSpec
{ {
private: private:
const Char *str_; const Char *str_;
public: public:
template <typename FillChar> template<typename FillChar>
StrFormatSpec(const Char *str, unsigned width, FillChar fill) StrFormatSpec(const Char *str, unsigned width, FillChar fill)
: AlignSpec(width, fill) : AlignSpec(width, fill)
, str_(str) , str_(str)
...@@ -2295,7 +2292,7 @@ IntFormatSpec<int, TypeSpec<'X'>> hexu(int value); ...@@ -2295,7 +2292,7 @@ IntFormatSpec<int, TypeSpec<'X'>> hexu(int value);
\endrst \endrst
*/ */
template <char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_CODE>, Char> pad(int value, unsigned width, Char fill = ' '); template<char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_CODE>, Char> pad(int value, unsigned width, Char fill = ' ');
#define FMT_DEFINE_INT_FORMATTERS(TYPE) \ #define FMT_DEFINE_INT_FORMATTERS(TYPE) \
inline IntFormatSpec<TYPE, TypeSpec<'b'>> bin(TYPE value) \ inline IntFormatSpec<TYPE, TypeSpec<'b'>> bin(TYPE value) \
...@@ -2318,7 +2315,7 @@ template <char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_C ...@@ -2318,7 +2315,7 @@ template <char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_C
return IntFormatSpec<TYPE, TypeSpec<'X'>>(value, TypeSpec<'X'>()); \ return IntFormatSpec<TYPE, TypeSpec<'X'>>(value, TypeSpec<'X'>()); \
} \ } \
\ \
template <char TYPE_CODE> \ template<char TYPE_CODE> \
inline IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>> pad(IntFormatSpec<TYPE, TypeSpec<TYPE_CODE>> f, unsigned width) \ inline IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>> pad(IntFormatSpec<TYPE, TypeSpec<TYPE_CODE>> f, unsigned width) \
{ \ { \
return IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>>(f.value(), AlignTypeSpec<TYPE_CODE>(width, ' ')); \ return IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>>(f.value(), AlignTypeSpec<TYPE_CODE>(width, ' ')); \
...@@ -2328,7 +2325,7 @@ template <char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_C ...@@ -2328,7 +2325,7 @@ template <char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_C
/* one that takes a fill character and one that doesn't. In the future this */ \ /* one that takes a fill character and one that doesn't. In the future this */ \
/* can be replaced with one overload making the template argument Char */ \ /* can be replaced with one overload making the template argument Char */ \
/* default to char (C++11). */ \ /* default to char (C++11). */ \
template <char TYPE_CODE, typename Char> \ template<char TYPE_CODE, typename Char> \
inline IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>, Char> pad( \ inline IntFormatSpec<TYPE, AlignTypeSpec<TYPE_CODE>, Char> pad( \
IntFormatSpec<TYPE, TypeSpec<TYPE_CODE>, Char> f, unsigned width, Char fill) \ IntFormatSpec<TYPE, TypeSpec<TYPE_CODE>, Char> f, unsigned width, Char fill) \
{ \ { \
...@@ -2340,7 +2337,7 @@ template <char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_C ...@@ -2340,7 +2337,7 @@ template <char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_C
return IntFormatSpec<TYPE, AlignTypeSpec<0>>(value, AlignTypeSpec<0>(width, ' ')); \ return IntFormatSpec<TYPE, AlignTypeSpec<0>>(value, AlignTypeSpec<0>(width, ' ')); \
} \ } \
\ \
template <typename Char> inline IntFormatSpec<TYPE, AlignTypeSpec<0>, Char> pad(TYPE value, unsigned width, Char fill) \ template<typename Char> inline IntFormatSpec<TYPE, AlignTypeSpec<0>, Char> pad(TYPE value, unsigned width, Char fill) \
{ \ { \
return IntFormatSpec<TYPE, AlignTypeSpec<0>, Char>(value, AlignTypeSpec<0>(width, fill)); \ return IntFormatSpec<TYPE, AlignTypeSpec<0>, Char>(value, AlignTypeSpec<0>(width, fill)); \
} }
...@@ -2364,7 +2361,7 @@ FMT_DEFINE_INT_FORMATTERS(ULongLong) ...@@ -2364,7 +2361,7 @@ FMT_DEFINE_INT_FORMATTERS(ULongLong)
\endrst \endrst
*/ */
template <typename Char> inline StrFormatSpec<Char> pad(const Char *str, unsigned width, Char fill = ' ') template<typename Char> inline StrFormatSpec<Char> pad(const Char *str, unsigned width, Char fill = ' ')
{ {
return StrFormatSpec<Char>(str, width, fill); return StrFormatSpec<Char>(str, width, fill);
} }
...@@ -2376,7 +2373,7 @@ inline StrFormatSpec<wchar_t> pad(const wchar_t *str, unsigned width, char fill ...@@ -2376,7 +2373,7 @@ inline StrFormatSpec<wchar_t> pad(const wchar_t *str, unsigned width, char fill
namespace internal { namespace internal {
template <typename Char> class ArgMap template<typename Char> class ArgMap
{ {
private: private:
typedef std::vector<std::pair<fmt::BasicStringRef<Char>, internal::Arg>> MapType; typedef std::vector<std::pair<fmt::BasicStringRef<Char>, internal::Arg>> MapType;
...@@ -2399,7 +2396,7 @@ public: ...@@ -2399,7 +2396,7 @@ public:
} }
}; };
template <typename Char> void ArgMap<Char>::init(const ArgList &args) template<typename Char> void ArgMap<Char>::init(const ArgList &args)
{ {
if (!map_.empty()) if (!map_.empty())
return; return;
...@@ -2452,7 +2449,7 @@ template <typename Char> void ArgMap<Char>::init(const ArgList &args) ...@@ -2452,7 +2449,7 @@ template <typename Char> void ArgMap<Char>::init(const ArgList &args)
} }
} }
template <typename Impl, typename Char, typename Spec = fmt::FormatSpec> class ArgFormatterBase : public ArgVisitor<Impl, void> template<typename Impl, typename Char, typename Spec = fmt::FormatSpec> class ArgFormatterBase : public ArgVisitor<Impl, void>
{ {
private: private:
BasicWriter<Char> &writer_; BasicWriter<Char> &writer_;
...@@ -2502,12 +2499,12 @@ public: ...@@ -2502,12 +2499,12 @@ public:
{ {
} }
template <typename T> void visit_any_int(T value) template<typename T> void visit_any_int(T value)
{ {
writer_.write_int(value, spec_); writer_.write_int(value, spec_);
} }
template <typename T> void visit_any_double(T value) template<typename T> void visit_any_double(T value)
{ {
writer_.write_double(value, spec_); writer_.write_double(value, spec_);
} }
...@@ -2636,7 +2633,7 @@ protected: ...@@ -2636,7 +2633,7 @@ protected:
return true; return true;
} }
template <typename Char> void write(BasicWriter<Char> &w, const Char *start, const Char *end) template<typename Char> void write(BasicWriter<Char> &w, const Char *start, const Char *end)
{ {
if (start != end) if (start != end)
w << BasicStringRef<Char>(start, internal::to_unsigned(end - start)); w << BasicStringRef<Char>(start, internal::to_unsigned(end - start));
...@@ -2661,7 +2658,7 @@ protected: ...@@ -2661,7 +2658,7 @@ protected:
will be called. will be called.
\endrst \endrst
*/ */
template <typename Impl, typename Char, typename Spec = fmt::FormatSpec> template<typename Impl, typename Char, typename Spec = fmt::FormatSpec>
class BasicArgFormatter : public internal::ArgFormatterBase<Impl, Char, Spec> class BasicArgFormatter : public internal::ArgFormatterBase<Impl, Char, Spec>
{ {
private: private:
...@@ -2692,7 +2689,7 @@ public: ...@@ -2692,7 +2689,7 @@ public:
}; };
/** The default argument formatter. */ /** The default argument formatter. */
template <typename Char> class ArgFormatter : public BasicArgFormatter<ArgFormatter<Char>, Char, FormatSpec> template<typename Char> class ArgFormatter : public BasicArgFormatter<ArgFormatter<Char>, Char, FormatSpec>
{ {
public: public:
/** Constructs an argument formatter object. */ /** Constructs an argument formatter object. */
...@@ -2703,7 +2700,7 @@ public: ...@@ -2703,7 +2700,7 @@ public:
}; };
/** This template formats data and writes the output to a writer. */ /** This template formats data and writes the output to a writer. */
template <typename CharType, typename ArgFormatter> class BasicFormatter : private internal::FormatterBase template<typename CharType, typename ArgFormatter> class BasicFormatter : private internal::FormatterBase
{ {
public: public:
/** The character type for the output. */ /** The character type for the output. */
...@@ -2779,19 +2776,19 @@ inline uint64_t make_type() ...@@ -2779,19 +2776,19 @@ inline uint64_t make_type()
return 0; return 0;
} }
template <typename T> inline uint64_t make_type(const T &arg) template<typename T> inline uint64_t make_type(const T &arg)
{ {
return MakeValue<BasicFormatter<char>>::type(arg); return MakeValue<BasicFormatter<char>>::type(arg);
} }
template <std::size_t N, bool /*IsPacked*/ = (N < ArgList::MAX_PACKED_ARGS)> struct ArgArray; template<std::size_t N, bool /*IsPacked*/ = (N < ArgList::MAX_PACKED_ARGS)> struct ArgArray;
template <std::size_t N> struct ArgArray<N, true /*IsPacked*/> template<std::size_t N> struct ArgArray<N, true /*IsPacked*/>
{ {
// '+' is used to silence GCC -Wduplicated-branches warning. // '+' is used to silence GCC -Wduplicated-branches warning.
typedef Value Type[N > 0 ? N : +1]; typedef Value Type[N > 0 ? N : +1];
template <typename Formatter, typename T> static Value make(const T &value) template<typename Formatter, typename T> static Value make(const T &value)
{ {
#ifdef __clang__ #ifdef __clang__
Value result = MakeValue<Formatter>(value); Value result = MakeValue<Formatter>(value);
...@@ -2805,18 +2802,18 @@ template <std::size_t N> struct ArgArray<N, true /*IsPacked*/> ...@@ -2805,18 +2802,18 @@ template <std::size_t N> struct ArgArray<N, true /*IsPacked*/>
} }
}; };
template <std::size_t N> struct ArgArray<N, false /*IsPacked*/> template<std::size_t N> struct ArgArray<N, false /*IsPacked*/>
{ {
typedef Arg Type[N + 1]; // +1 for the list end Arg::NONE typedef Arg Type[N + 1]; // +1 for the list end Arg::NONE
template <typename Formatter, typename T> static Arg make(const T &value) template<typename Formatter, typename T> static Arg make(const T &value)
{ {
return MakeArg<Formatter>(value); return MakeArg<Formatter>(value);
} }
}; };
#if FMT_USE_VARIADIC_TEMPLATES #if FMT_USE_VARIADIC_TEMPLATES
template <typename Arg, typename... Args> inline uint64_t make_type(const Arg &first, const Args &... tail) template<typename Arg, typename... Args> inline uint64_t make_type(const Arg &first, const Args &... tail)
{ {
return make_type(first) | (make_type(tail...) << 4); return make_type(first) | (make_type(tail...) << 4);
} }
...@@ -2832,7 +2829,7 @@ struct ArgType ...@@ -2832,7 +2829,7 @@ struct ArgType
{ {
} }
template <typename T> template<typename T>
ArgType(const T &arg) ArgType(const T &arg)
: type(make_type(arg)) : type(make_type(arg))
{ {
...@@ -2859,7 +2856,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) ...@@ -2859,7 +2856,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT))
#if FMT_USE_VARIADIC_TEMPLATES #if FMT_USE_VARIADIC_TEMPLATES
// Defines a variadic function returning void. // Defines a variadic function returning void.
#define FMT_VARIADIC_VOID(func, arg_type) \ #define FMT_VARIADIC_VOID(func, arg_type) \
template <typename... Args> void func(arg_type arg0, const Args &... args) \ template<typename... Args> void func(arg_type arg0, const Args &... args) \
{ \ { \
typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \ typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \
typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \ typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \
...@@ -2868,7 +2865,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) ...@@ -2868,7 +2865,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT))
// Defines a variadic constructor. // Defines a variadic constructor.
#define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ #define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \
template <typename... Args> ctor(arg0_type arg0, arg1_type arg1, const Args &... args) \ template<typename... Args> ctor(arg0_type arg0, arg1_type arg1, const Args &... args) \
{ \ { \
typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \ typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \
typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \ typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \
...@@ -2883,7 +2880,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) ...@@ -2883,7 +2880,7 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT))
// Defines a wrapper for a function taking one argument of type arg_type // Defines a wrapper for a function taking one argument of type arg_type
// and n additional arguments of arbitrary types. // and n additional arguments of arbitrary types.
#define FMT_WRAP1(func, arg_type, n) \ #define FMT_WRAP1(func, arg_type, n) \
template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> inline void func(arg_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) \ template<FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> inline void func(arg_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) \
{ \ { \
const fmt::internal::ArgArray<n>::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \ const fmt::internal::ArgArray<n>::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \
func(arg1, fmt::ArgList(fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \ func(arg1, fmt::ArgList(fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \
...@@ -2899,11 +2896,12 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT)) ...@@ -2899,11 +2896,12 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT))
FMT_WRAP1(func, arg_type, 2) \ FMT_WRAP1(func, arg_type, 2) \
FMT_WRAP1(func, arg_type, 3) \ FMT_WRAP1(func, arg_type, 3) \
FMT_WRAP1(func, arg_type, 4) \ FMT_WRAP1(func, arg_type, 4) \
FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) FMT_WRAP1(func, arg_type, 7) FMT_WRAP1(func, arg_type, 8) \ FMT_WRAP1(func, arg_type, 5) \
FMT_WRAP1(func, arg_type, 9) FMT_WRAP1(func, arg_type, 10) FMT_WRAP1(func, arg_type, 6) \
FMT_WRAP1(func, arg_type, 7) FMT_WRAP1(func, arg_type, 8) FMT_WRAP1(func, arg_type, 9) FMT_WRAP1(func, arg_type, 10)
#define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \ #define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \
template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) \ template<FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) \
{ \ { \
const fmt::internal::ArgArray<n>::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \ const fmt::internal::ArgArray<n>::Type array = {FMT_GEN(n, FMT_MAKE_REF)}; \
func(arg0, arg1, fmt::ArgList(fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \ func(arg0, arg1, fmt::ArgList(fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \
...@@ -3022,7 +3020,7 @@ FMT_API void format_system_error(fmt::Writer &out, int error_code, fmt::StringRe ...@@ -3022,7 +3020,7 @@ FMT_API void format_system_error(fmt::Writer &out, int error_code, fmt::StringRe
\endrst \endrst
*/ */
template <typename Char> class BasicWriter template<typename Char> class BasicWriter
{ {
private: private:
// Output buffer. // Output buffer.
...@@ -3059,7 +3057,7 @@ private: ...@@ -3059,7 +3057,7 @@ private:
} }
// Writes an unsigned decimal integer. // Writes an unsigned decimal integer.
template <typename UInt> Char *write_unsigned_decimal(UInt value, unsigned prefix_size = 0) template<typename UInt> Char *write_unsigned_decimal(UInt value, unsigned prefix_size = 0)
{ {
unsigned num_digits = internal::count_digits(value); unsigned num_digits = internal::count_digits(value);
Char *ptr = get(grow_buffer(prefix_size + num_digits)); Char *ptr = get(grow_buffer(prefix_size + num_digits));
...@@ -3068,7 +3066,7 @@ private: ...@@ -3068,7 +3066,7 @@ private:
} }
// Writes a decimal integer. // Writes a decimal integer.
template <typename Int> void write_decimal(Int value) template<typename Int> void write_decimal(Int value)
{ {
typedef typename internal::IntTraits<Int>::MainType MainType; typedef typename internal::IntTraits<Int>::MainType MainType;
MainType abs_value = static_cast<MainType>(value); MainType abs_value = static_cast<MainType>(value);
...@@ -3092,18 +3090,18 @@ private: ...@@ -3092,18 +3090,18 @@ private:
return p + size - 1; return p + size - 1;
} }
template <typename Spec> CharPtr prepare_int_buffer(unsigned num_digits, const Spec &spec, const char *prefix, unsigned prefix_size); template<typename Spec> CharPtr prepare_int_buffer(unsigned num_digits, const Spec &spec, const char *prefix, unsigned prefix_size);
// Formats an integer. // Formats an integer.
template <typename T, typename Spec> void write_int(T value, Spec spec); template<typename T, typename Spec> void write_int(T value, Spec spec);
// Formats a floating-point number (double or long double). // Formats a floating-point number (double or long double).
template <typename T, typename Spec> void write_double(T value, const Spec &spec); template<typename T, typename Spec> void write_double(T value, const Spec &spec);
// Writes a formatted string. // Writes a formatted string.
template <typename StrChar> CharPtr write_str(const StrChar *s, std::size_t size, const AlignSpec &spec); template<typename StrChar> CharPtr write_str(const StrChar *s, std::size_t size, const AlignSpec &spec);
template <typename StrChar, typename Spec> void write_str(const internal::Arg::StringValue<StrChar> &str, const Spec &spec); template<typename StrChar, typename Spec> void write_str(const internal::Arg::StringValue<StrChar> &str, const Spec &spec);
// This following methods are private to disallow writing wide characters // This following methods are private to disallow writing wide characters
// and strings to a char stream. If you want to print a wide string as a // and strings to a char stream. If you want to print a wide string as a
...@@ -3119,11 +3117,11 @@ private: ...@@ -3119,11 +3117,11 @@ private:
*format_ptr++ = 'L'; *format_ptr++ = 'L';
} }
template <typename T> void append_float_length(Char *&, T) {} template<typename T> void append_float_length(Char *&, T) {}
template <typename Impl, typename Char_, typename Spec_> friend class internal::ArgFormatterBase; template<typename Impl, typename Char_, typename Spec_> friend class internal::ArgFormatterBase;
template <typename Impl, typename Char_, typename Spec_> friend class BasicPrintfArgFormatter; template<typename Impl, typename Char_, typename Spec_> friend class BasicPrintfArgFormatter;
protected: protected:
/** /**
...@@ -3298,14 +3296,14 @@ public: ...@@ -3298,14 +3296,14 @@ public:
return *this; return *this;
} }
template <typename T, typename Spec, typename FillChar> BasicWriter &operator<<(IntFormatSpec<T, Spec, FillChar> spec) template<typename T, typename Spec, typename FillChar> BasicWriter &operator<<(IntFormatSpec<T, Spec, FillChar> spec)
{ {
internal::CharTraits<Char>::convert(FillChar()); internal::CharTraits<Char>::convert(FillChar());
write_int(spec.value(), spec); write_int(spec.value(), spec);
return *this; return *this;
} }
template <typename StrChar> BasicWriter &operator<<(const StrFormatSpec<StrChar> &spec) template<typename StrChar> BasicWriter &operator<<(const StrFormatSpec<StrChar> &spec)
{ {
const StrChar *s = spec.str(); const StrChar *s = spec.str();
write_str(s, std::char_traits<Char>::length(s), spec); write_str(s, std::char_traits<Char>::length(s), spec);
...@@ -3323,8 +3321,8 @@ public: ...@@ -3323,8 +3321,8 @@ public:
} }
}; };
template <typename Char> template<typename Char>
template <typename StrChar> template<typename StrChar>
typename BasicWriter<Char>::CharPtr BasicWriter<Char>::write_str(const StrChar *s, std::size_t size, const AlignSpec &spec) typename BasicWriter<Char>::CharPtr BasicWriter<Char>::write_str(const StrChar *s, std::size_t size, const AlignSpec &spec)
{ {
CharPtr out = CharPtr(); CharPtr out = CharPtr();
...@@ -3354,8 +3352,8 @@ typename BasicWriter<Char>::CharPtr BasicWriter<Char>::write_str(const StrChar * ...@@ -3354,8 +3352,8 @@ typename BasicWriter<Char>::CharPtr BasicWriter<Char>::write_str(const StrChar *
return out; return out;
} }
template <typename Char> template<typename Char>
template <typename StrChar, typename Spec> template<typename StrChar, typename Spec>
void BasicWriter<Char>::write_str(const internal::Arg::StringValue<StrChar> &s, const Spec &spec) void BasicWriter<Char>::write_str(const internal::Arg::StringValue<StrChar> &s, const Spec &spec)
{ {
// Check if StrChar is convertible to Char. // Check if StrChar is convertible to Char.
...@@ -3377,7 +3375,7 @@ void BasicWriter<Char>::write_str(const internal::Arg::StringValue<StrChar> &s, ...@@ -3377,7 +3375,7 @@ void BasicWriter<Char>::write_str(const internal::Arg::StringValue<StrChar> &s,
write_str(str_value, str_size, spec); write_str(str_value, str_size, spec);
} }
template <typename Char> template<typename Char>
typename BasicWriter<Char>::CharPtr BasicWriter<Char>::fill_padding( typename BasicWriter<Char>::CharPtr BasicWriter<Char>::fill_padding(
CharPtr buffer, unsigned total_size, std::size_t content_size, wchar_t fill) CharPtr buffer, unsigned total_size, std::size_t content_size, wchar_t fill)
{ {
...@@ -3391,8 +3389,8 @@ typename BasicWriter<Char>::CharPtr BasicWriter<Char>::fill_padding( ...@@ -3391,8 +3389,8 @@ typename BasicWriter<Char>::CharPtr BasicWriter<Char>::fill_padding(
return content; return content;
} }
template <typename Char> template<typename Char>
template <typename Spec> template<typename Spec>
typename BasicWriter<Char>::CharPtr BasicWriter<Char>::prepare_int_buffer( typename BasicWriter<Char>::CharPtr BasicWriter<Char>::prepare_int_buffer(
unsigned num_digits, const Spec &spec, const char *prefix, unsigned prefix_size) unsigned num_digits, const Spec &spec, const char *prefix, unsigned prefix_size)
{ {
...@@ -3465,7 +3463,7 @@ typename BasicWriter<Char>::CharPtr BasicWriter<Char>::prepare_int_buffer( ...@@ -3465,7 +3463,7 @@ typename BasicWriter<Char>::CharPtr BasicWriter<Char>::prepare_int_buffer(
return p - 1; return p - 1;
} }
template <typename Char> template <typename T, typename Spec> void BasicWriter<Char>::write_int(T value, Spec spec) template<typename Char> template<typename T, typename Spec> void BasicWriter<Char>::write_int(T value, Spec spec)
{ {
unsigned prefix_size = 0; unsigned prefix_size = 0;
typedef typename internal::IntTraits<T>::MainType UnsignedType; typedef typename internal::IntTraits<T>::MainType UnsignedType;
...@@ -3573,7 +3571,7 @@ template <typename Char> template <typename T, typename Spec> void BasicWriter<C ...@@ -3573,7 +3571,7 @@ template <typename Char> template <typename T, typename Spec> void BasicWriter<C
} }
} }
template <typename Char> template <typename T, typename Spec> void BasicWriter<Char>::write_double(T value, const Spec &spec) template<typename Char> template<typename T, typename Spec> void BasicWriter<Char>::write_double(T value, const Spec &spec)
{ {
// Check type. // Check type.
char type = spec.type(); char type = spec.type();
...@@ -3791,7 +3789,7 @@ template <typename Char> template <typename T, typename Spec> void BasicWriter<C ...@@ -3791,7 +3789,7 @@ template <typename Char> template <typename T, typename Spec> void BasicWriter<C
accessed as a C string with ``out.c_str()``. accessed as a C string with ``out.c_str()``.
\endrst \endrst
*/ */
template <typename Char, typename Allocator = std::allocator<Char>> class BasicMemoryWriter : public BasicWriter<Char> template<typename Char, typename Allocator = std::allocator<Char>> class BasicMemoryWriter : public BasicWriter<Char>
{ {
private: private:
internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE, Allocator> buffer_; internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE, Allocator> buffer_;
...@@ -3852,7 +3850,7 @@ typedef BasicMemoryWriter<wchar_t> WMemoryWriter; ...@@ -3852,7 +3850,7 @@ typedef BasicMemoryWriter<wchar_t> WMemoryWriter;
+--------------+---------------------------+ +--------------+---------------------------+
\endrst \endrst
*/ */
template <typename Char> class BasicArrayWriter : public BasicWriter<Char> template<typename Char> class BasicArrayWriter : public BasicWriter<Char>
{ {
private: private:
internal::FixedBuffer<Char> buffer_; internal::FixedBuffer<Char> buffer_;
...@@ -3876,7 +3874,7 @@ public: ...@@ -3876,7 +3874,7 @@ public:
size known at compile time. size known at compile time.
\endrst \endrst
*/ */
template <std::size_t SIZE> template<std::size_t SIZE>
explicit BasicArrayWriter(Char (&array)[SIZE]) explicit BasicArrayWriter(Char (&array)[SIZE])
: BasicWriter<Char>(buffer_) : BasicWriter<Char>(buffer_)
, buffer_(array, SIZE) , buffer_(array, SIZE)
...@@ -4122,7 +4120,7 @@ public: ...@@ -4122,7 +4120,7 @@ public:
// Formats a decimal integer value writing into buffer and returns // Formats a decimal integer value writing into buffer and returns
// a pointer to the end of the formatted string. This function doesn't // a pointer to the end of the formatted string. This function doesn't
// write a terminating null character. // write a terminating null character.
template <typename T> inline void format_decimal(char *&buffer, T value) template<typename T> inline void format_decimal(char *&buffer, T value)
{ {
typedef typename internal::IntTraits<T>::MainType MainType; typedef typename internal::IntTraits<T>::MainType MainType;
MainType abs_value = static_cast<MainType>(value); MainType abs_value = static_cast<MainType>(value);
...@@ -4158,20 +4156,20 @@ template <typename T> inline void format_decimal(char *&buffer, T value) ...@@ -4158,20 +4156,20 @@ template <typename T> inline void format_decimal(char *&buffer, T value)
\endrst \endrst
*/ */
template <typename T> inline internal::NamedArgWithType<char, T> arg(StringRef name, const T &arg) template<typename T> inline internal::NamedArgWithType<char, T> arg(StringRef name, const T &arg)
{ {
return internal::NamedArgWithType<char, T>(name, arg); return internal::NamedArgWithType<char, T>(name, arg);
} }
template <typename T> inline internal::NamedArgWithType<wchar_t, T> arg(WStringRef name, const T &arg) template<typename T> inline internal::NamedArgWithType<wchar_t, T> arg(WStringRef name, const T &arg)
{ {
return internal::NamedArgWithType<wchar_t, T>(name, arg); return internal::NamedArgWithType<wchar_t, T>(name, arg);
} }
// The following two functions are deleted intentionally to disable // The following two functions are deleted intentionally to disable
// nested named arguments as in ``format("{}", arg("a", arg("b", 42)))``. // nested named arguments as in ``format("{}", arg("a", arg("b", 42)))``.
template <typename Char> void arg(StringRef, const internal::NamedArg<Char> &) FMT_DELETED_OR_UNDEFINED; template<typename Char> void arg(StringRef, const internal::NamedArg<Char> &) FMT_DELETED_OR_UNDEFINED;
template <typename Char> void arg(WStringRef, const internal::NamedArg<Char> &) FMT_DELETED_OR_UNDEFINED; template<typename Char> void arg(WStringRef, const internal::NamedArg<Char> &) FMT_DELETED_OR_UNDEFINED;
} // namespace fmt } // namespace fmt
#if FMT_GCC_VERSION #if FMT_GCC_VERSION
...@@ -4200,7 +4198,7 @@ template <typename Char> void arg(WStringRef, const internal::NamedArg<Char> &) ...@@ -4200,7 +4198,7 @@ template <typename Char> void arg(WStringRef, const internal::NamedArg<Char> &)
#if FMT_USE_VARIADIC_TEMPLATES #if FMT_USE_VARIADIC_TEMPLATES
#define FMT_VARIADIC_(Const, Char, ReturnType, func, call, ...) \ #define FMT_VARIADIC_(Const, Char, ReturnType, func, call, ...) \
template <typename... Args> ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), const Args &... args) Const \ template<typename... Args> ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), const Args &... args) Const \
{ \ { \
typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \ typedef fmt::internal::ArgArray<sizeof...(Args)> ArgArray; \
typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \ typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \
...@@ -4210,7 +4208,7 @@ template <typename Char> void arg(WStringRef, const internal::NamedArg<Char> &) ...@@ -4210,7 +4208,7 @@ template <typename Char> void arg(WStringRef, const internal::NamedArg<Char> &)
// Defines a wrapper for a function taking __VA_ARGS__ arguments // Defines a wrapper for a function taking __VA_ARGS__ arguments
// and n additional arguments of arbitrary types. // and n additional arguments of arbitrary types.
#define FMT_WRAP(Const, Char, ReturnType, func, call, n, ...) \ #define FMT_WRAP(Const, Char, ReturnType, func, call, n, ...) \
template <FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \ template<FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> \
inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), FMT_GEN(n, FMT_MAKE_ARG)) Const \ inline ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), FMT_GEN(n, FMT_MAKE_ARG)) Const \
{ \ { \
fmt::internal::ArgArray<n>::Type arr; \ fmt::internal::ArgArray<n>::Type arr; \
...@@ -4305,14 +4303,14 @@ FMT_VARIADIC(void, print, std::FILE *, CStringRef) ...@@ -4305,14 +4303,14 @@ FMT_VARIADIC(void, print, std::FILE *, CStringRef)
FMT_VARIADIC(void, print_colored, Color, CStringRef) FMT_VARIADIC(void, print_colored, Color, CStringRef)
namespace internal { namespace internal {
template <typename Char> inline bool is_name_start(Char c) template<typename Char> inline bool is_name_start(Char c)
{ {
return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || '_' == c; return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || '_' == c;
} }
// Parses an unsigned integer advancing s to the end of the parsed input. // Parses an unsigned integer advancing s to the end of the parsed input.
// This function assumes that the first character of s is a digit. // This function assumes that the first character of s is a digit.
template <typename Char> unsigned parse_nonnegative_int(const Char *&s) template<typename Char> unsigned parse_nonnegative_int(const Char *&s)
{ {
assert('0' <= *s && *s <= '9'); assert('0' <= *s && *s <= '9');
unsigned value = 0; unsigned value = 0;
...@@ -4345,7 +4343,7 @@ inline void require_numeric_argument(const Arg &arg, char spec) ...@@ -4345,7 +4343,7 @@ inline void require_numeric_argument(const Arg &arg, char spec)
} }
} }
template <typename Char> void check_sign(const Char *&s, const Arg &arg) template<typename Char> void check_sign(const Char *&s, const Arg &arg)
{ {
char sign = static_cast<char>(*s); char sign = static_cast<char>(*s);
require_numeric_argument(arg, sign); require_numeric_argument(arg, sign);
...@@ -4357,7 +4355,7 @@ template <typename Char> void check_sign(const Char *&s, const Arg &arg) ...@@ -4357,7 +4355,7 @@ template <typename Char> void check_sign(const Char *&s, const Arg &arg)
} }
} // namespace internal } // namespace internal
template <typename Char, typename AF> template<typename Char, typename AF>
inline internal::Arg BasicFormatter<Char, AF>::get_arg(BasicStringRef<Char> arg_name, const char *&error) inline internal::Arg BasicFormatter<Char, AF>::get_arg(BasicStringRef<Char> arg_name, const char *&error)
{ {
if (check_no_auto_index(error)) if (check_no_auto_index(error))
...@@ -4371,7 +4369,7 @@ inline internal::Arg BasicFormatter<Char, AF>::get_arg(BasicStringRef<Char> arg_ ...@@ -4371,7 +4369,7 @@ inline internal::Arg BasicFormatter<Char, AF>::get_arg(BasicStringRef<Char> arg_
return internal::Arg(); return internal::Arg();
} }
template <typename Char, typename AF> inline internal::Arg BasicFormatter<Char, AF>::parse_arg_index(const Char *&s) template<typename Char, typename AF> inline internal::Arg BasicFormatter<Char, AF>::parse_arg_index(const Char *&s)
{ {
const char *error = FMT_NULL; const char *error = FMT_NULL;
internal::Arg arg = *s < '0' || *s > '9' ? next_arg(error) : get_arg(internal::parse_nonnegative_int(s), error); internal::Arg arg = *s < '0' || *s > '9' ? next_arg(error) : get_arg(internal::parse_nonnegative_int(s), error);
...@@ -4382,7 +4380,7 @@ template <typename Char, typename AF> inline internal::Arg BasicFormatter<Char, ...@@ -4382,7 +4380,7 @@ template <typename Char, typename AF> inline internal::Arg BasicFormatter<Char,
return arg; return arg;
} }
template <typename Char, typename AF> inline internal::Arg BasicFormatter<Char, AF>::parse_arg_name(const Char *&s) template<typename Char, typename AF> inline internal::Arg BasicFormatter<Char, AF>::parse_arg_name(const Char *&s)
{ {
assert(internal::is_name_start(*s)); assert(internal::is_name_start(*s));
const Char *start = s; const Char *start = s;
...@@ -4398,7 +4396,7 @@ template <typename Char, typename AF> inline internal::Arg BasicFormatter<Char, ...@@ -4398,7 +4396,7 @@ template <typename Char, typename AF> inline internal::Arg BasicFormatter<Char,
return arg; return arg;
} }
template <typename Char, typename ArgFormatter> template<typename Char, typename ArgFormatter>
const Char *BasicFormatter<Char, ArgFormatter>::format(const Char *&format_str, const internal::Arg &arg) const Char *BasicFormatter<Char, ArgFormatter>::format(const Char *&format_str, const internal::Arg &arg)
{ {
using internal::Arg; using internal::Arg;
...@@ -4592,7 +4590,7 @@ const Char *BasicFormatter<Char, ArgFormatter>::format(const Char *&format_str, ...@@ -4592,7 +4590,7 @@ const Char *BasicFormatter<Char, ArgFormatter>::format(const Char *&format_str,
return s; return s;
} }
template <typename Char, typename AF> void BasicFormatter<Char, AF>::format(BasicCStringRef<Char> format_str) template<typename Char, typename AF> void BasicFormatter<Char, AF>::format(BasicCStringRef<Char> format_str)
{ {
const Char *s = format_str.c_str(); const Char *s = format_str.c_str();
const Char *start = s; const Char *start = s;
...@@ -4616,7 +4614,7 @@ template <typename Char, typename AF> void BasicFormatter<Char, AF>::format(Basi ...@@ -4616,7 +4614,7 @@ template <typename Char, typename AF> void BasicFormatter<Char, AF>::format(Basi
write(writer_, start, s); write(writer_, start, s);
} }
template <typename Char, typename It> struct ArgJoin template<typename Char, typename It> struct ArgJoin
{ {
It first; It first;
It last; It last;
...@@ -4630,30 +4628,29 @@ template <typename Char, typename It> struct ArgJoin ...@@ -4630,30 +4628,29 @@ template <typename Char, typename It> struct ArgJoin
} }
}; };
template <typename It> ArgJoin<char, It> join(It first, It last, const BasicCStringRef<char> &sep) template<typename It> ArgJoin<char, It> join(It first, It last, const BasicCStringRef<char> &sep)
{ {
return ArgJoin<char, It>(first, last, sep); return ArgJoin<char, It>(first, last, sep);
} }
template <typename It> ArgJoin<wchar_t, It> join(It first, It last, const BasicCStringRef<wchar_t> &sep) template<typename It> ArgJoin<wchar_t, It> join(It first, It last, const BasicCStringRef<wchar_t> &sep)
{ {
return ArgJoin<wchar_t, It>(first, last, sep); return ArgJoin<wchar_t, It>(first, last, sep);
} }
#if FMT_HAS_GXX_CXX11 #if FMT_HAS_GXX_CXX11
template <typename Range> auto join(const Range &range, const BasicCStringRef<char> &sep) -> ArgJoin<char, decltype(std::begin(range))> template<typename Range> auto join(const Range &range, const BasicCStringRef<char> &sep) -> ArgJoin<char, decltype(std::begin(range))>
{ {
return join(std::begin(range), std::end(range), sep); return join(std::begin(range), std::end(range), sep);
} }
template <typename Range> template<typename Range> auto join(const Range &range, const BasicCStringRef<wchar_t> &sep) -> ArgJoin<wchar_t, decltype(std::begin(range))>
auto join(const Range &range, const BasicCStringRef<wchar_t> &sep) -> ArgJoin<wchar_t, decltype(std::begin(range))>
{ {
return join(std::begin(range), std::end(range), sep); return join(std::begin(range), std::end(range), sep);
} }
#endif #endif
template <typename ArgFormatter, typename Char, typename It> template<typename ArgFormatter, typename Char, typename It>
void format_arg(fmt::BasicFormatter<Char, ArgFormatter> &f, const Char *&format_str, const ArgJoin<Char, It> &e) void format_arg(fmt::BasicFormatter<Char, ArgFormatter> &f, const Char *&format_str, const ArgJoin<Char, It> &e)
{ {
const Char *end = format_str; const Char *end = format_str;
...@@ -4684,21 +4681,21 @@ void format_arg(fmt::BasicFormatter<Char, ArgFormatter> &f, const Char *&format_ ...@@ -4684,21 +4681,21 @@ void format_arg(fmt::BasicFormatter<Char, ArgFormatter> &f, const Char *&format_
namespace fmt { namespace fmt {
namespace internal { namespace internal {
template <typename Char> struct UdlFormat template<typename Char> struct UdlFormat
{ {
const Char *str; const Char *str;
template <typename... Args> auto operator()(Args &&... args) const -> decltype(format(str, std::forward<Args>(args)...)) template<typename... Args> auto operator()(Args &&... args) const -> decltype(format(str, std::forward<Args>(args)...))
{ {
return format(str, std::forward<Args>(args)...); return format(str, std::forward<Args>(args)...);
} }
}; };
template <typename Char> struct UdlArg template<typename Char> struct UdlArg
{ {
const Char *str; const Char *str;
template <typename T> NamedArgWithType<Char, T> operator=(T &&value) const template<typename T> NamedArgWithType<Char, T> operator=(T &&value) const
{ {
return {str, std::forward<T>(value)}; return {str, std::forward<T>(value)};
} }
......
...@@ -17,7 +17,7 @@ namespace fmt { ...@@ -17,7 +17,7 @@ namespace fmt {
namespace internal { namespace internal {
template <class Char> class FormatBuf : public std::basic_streambuf<Char> template<class Char> class FormatBuf : public std::basic_streambuf<Char>
{ {
private: private:
typedef typename std::basic_streambuf<Char>::int_type int_type; typedef typename std::basic_streambuf<Char>::int_type int_type;
...@@ -60,12 +60,12 @@ struct DummyStream : std::ostream ...@@ -60,12 +60,12 @@ struct DummyStream : std::ostream
DummyStream(); // Suppress a bogus warning in MSVC. DummyStream(); // Suppress a bogus warning in MSVC.
// Hide all operator<< overloads from std::ostream. // Hide all operator<< overloads from std::ostream.
template <typename T> typename EnableIf<sizeof(T) == 0>::type operator<<(const T &); template<typename T> typename EnableIf<sizeof(T) == 0>::type operator<<(const T &);
}; };
No &operator<<(std::ostream &, int); No &operator<<(std::ostream &, int);
template <typename T> struct ConvertToIntImpl<T, true> template<typename T> struct ConvertToIntImpl<T, true>
{ {
// Convert to int only if T doesn't have an overloaded operator<<. // Convert to int only if T doesn't have an overloaded operator<<.
enum enum
...@@ -79,7 +79,7 @@ FMT_API void write(std::ostream &os, Writer &w); ...@@ -79,7 +79,7 @@ FMT_API void write(std::ostream &os, Writer &w);
} // namespace internal } // namespace internal
// Formats a value. // Formats a value.
template <typename Char, typename ArgFormatter_, typename T> template<typename Char, typename ArgFormatter_, typename T>
void format_arg(BasicFormatter<Char, ArgFormatter_> &f, const Char *&format_str, const T &value) void format_arg(BasicFormatter<Char, ArgFormatter_> &f, const Char *&format_str, const T &value)
{ {
internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE> buffer; internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE> buffer;
......
...@@ -20,9 +20,9 @@ namespace internal { ...@@ -20,9 +20,9 @@ namespace internal {
// Checks if a value fits in int - used to avoid warnings about comparing // Checks if a value fits in int - used to avoid warnings about comparing
// signed and unsigned integers. // signed and unsigned integers.
template <bool IsSigned> struct IntChecker template<bool IsSigned> struct IntChecker
{ {
template <typename T> static bool fits_in_int(T value) template<typename T> static bool fits_in_int(T value)
{ {
unsigned max = std::numeric_limits<int>::max(); unsigned max = std::numeric_limits<int>::max();
return value <= max; return value <= max;
...@@ -33,9 +33,9 @@ template <bool IsSigned> struct IntChecker ...@@ -33,9 +33,9 @@ template <bool IsSigned> struct IntChecker
} }
}; };
template <> struct IntChecker<true> template<> struct IntChecker<true>
{ {
template <typename T> static bool fits_in_int(T value) template<typename T> static bool fits_in_int(T value)
{ {
return value >= std::numeric_limits<int>::min() && value <= std::numeric_limits<int>::max(); return value >= std::numeric_limits<int>::min() && value <= std::numeric_limits<int>::max();
} }
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
FMT_THROW(FormatError("precision is not integer")); FMT_THROW(FormatError("precision is not integer"));
} }
template <typename T> int visit_any_int(T value) template<typename T> int visit_any_int(T value)
{ {
if (!IntChecker<std::numeric_limits<T>::is_signed>::fits_in_int(value)) if (!IntChecker<std::numeric_limits<T>::is_signed>::fits_in_int(value))
FMT_THROW(FormatError("number is too big")); FMT_THROW(FormatError("number is too big"));
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
class IsZeroInt : public ArgVisitor<IsZeroInt, bool> class IsZeroInt : public ArgVisitor<IsZeroInt, bool>
{ {
public: public:
template <typename T> bool visit_any_int(T value) template<typename T> bool visit_any_int(T value)
{ {
return value == 0; return value == 0;
} }
...@@ -90,12 +90,12 @@ public: ...@@ -90,12 +90,12 @@ public:
return 'p'; return 'p';
} }
template <typename T> char visit_any_int(T) template<typename T> char visit_any_int(T)
{ {
return 'd'; return 'd';
} }
template <typename T> char visit_any_double(T) template<typename T> char visit_any_double(T)
{ {
return 'g'; return 'g';
} }
...@@ -106,7 +106,7 @@ public: ...@@ -106,7 +106,7 @@ public:
} }
}; };
template <typename T, typename U> struct is_same template<typename T, typename U> struct is_same
{ {
enum enum
{ {
...@@ -114,7 +114,7 @@ template <typename T, typename U> struct is_same ...@@ -114,7 +114,7 @@ template <typename T, typename U> struct is_same
}; };
}; };
template <typename T> struct is_same<T, T> template<typename T> struct is_same<T, T>
{ {
enum enum
{ {
...@@ -126,7 +126,7 @@ template <typename T> struct is_same<T, T> ...@@ -126,7 +126,7 @@ template <typename T> struct is_same<T, T>
// if T is an integral type. If T is void, the argument is converted to // if T is an integral type. If T is void, the argument is converted to
// corresponding signed or unsigned type depending on the type specifier: // corresponding signed or unsigned type depending on the type specifier:
// 'd' and 'i' - signed, other - unsigned) // 'd' and 'i' - signed, other - unsigned)
template <typename T = void> class ArgConverter : public ArgVisitor<ArgConverter<T>, void> template<typename T = void> class ArgConverter : public ArgVisitor<ArgConverter<T>, void>
{ {
private: private:
internal::Arg &arg_; internal::Arg &arg_;
...@@ -153,7 +153,7 @@ public: ...@@ -153,7 +153,7 @@ public:
visit_any_int(value); visit_any_int(value);
} }
template <typename U> void visit_any_int(U value) template<typename U> void visit_any_int(U value)
{ {
bool is_signed = type_ == 'd' || type_ == 'i'; bool is_signed = type_ == 'd' || type_ == 'i';
if (type_ == 's') if (type_ == 's')
...@@ -211,7 +211,7 @@ public: ...@@ -211,7 +211,7 @@ public:
{ {
} }
template <typename T> void visit_any_int(T value) template<typename T> void visit_any_int(T value)
{ {
arg_.type = internal::Arg::CHAR; arg_.type = internal::Arg::CHAR;
arg_.int_value = static_cast<char>(value); arg_.int_value = static_cast<char>(value);
...@@ -238,7 +238,7 @@ public: ...@@ -238,7 +238,7 @@ public:
FMT_THROW(FormatError("width is not integer")); FMT_THROW(FormatError("width is not integer"));
} }
template <typename T> unsigned visit_any_int(T value) template<typename T> unsigned visit_any_int(T value)
{ {
typedef typename internal::IntTraits<T>::MainType UnsignedType; typedef typename internal::IntTraits<T>::MainType UnsignedType;
UnsignedType width = static_cast<UnsignedType>(value); UnsignedType width = static_cast<UnsignedType>(value);
...@@ -272,7 +272,7 @@ public: ...@@ -272,7 +272,7 @@ public:
superclass will be called. superclass will be called.
\endrst \endrst
*/ */
template <typename Impl, typename Char, typename Spec> class BasicPrintfArgFormatter : public internal::ArgFormatterBase<Impl, Char, Spec> template<typename Impl, typename Char, typename Spec> class BasicPrintfArgFormatter : public internal::ArgFormatterBase<Impl, Char, Spec>
{ {
private: private:
void write_null_pointer() void write_null_pointer()
...@@ -367,7 +367,7 @@ public: ...@@ -367,7 +367,7 @@ public:
}; };
/** The default printf argument formatter. */ /** The default printf argument formatter. */
template <typename Char> class PrintfArgFormatter : public BasicPrintfArgFormatter<PrintfArgFormatter<Char>, Char, FormatSpec> template<typename Char> class PrintfArgFormatter : public BasicPrintfArgFormatter<PrintfArgFormatter<Char>, Char, FormatSpec>
{ {
public: public:
/** Constructs an argument formatter object. */ /** Constructs an argument formatter object. */
...@@ -378,7 +378,7 @@ public: ...@@ -378,7 +378,7 @@ public:
}; };
/** This template formats data and writes the output to a writer. */ /** This template formats data and writes the output to a writer. */
template <typename Char, typename ArgFormatter = PrintfArgFormatter<Char>> class PrintfFormatter : private internal::FormatterBase template<typename Char, typename ArgFormatter = PrintfArgFormatter<Char>> class PrintfFormatter : private internal::FormatterBase
{ {
private: private:
BasicWriter<Char> &writer_; BasicWriter<Char> &writer_;
...@@ -410,7 +410,7 @@ public: ...@@ -410,7 +410,7 @@ public:
void format(BasicCStringRef<Char> format_str); void format(BasicCStringRef<Char> format_str);
}; };
template <typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags(FormatSpec &spec, const Char *&s) template<typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags(FormatSpec &spec, const Char *&s)
{ {
for (;;) for (;;)
{ {
...@@ -438,7 +438,7 @@ template <typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flag ...@@ -438,7 +438,7 @@ template <typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flag
} }
} }
template <typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::get_arg(const Char *s, unsigned arg_index) template<typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::get_arg(const Char *s, unsigned arg_index)
{ {
(void)s; (void)s;
const char *error = FMT_NULL; const char *error = FMT_NULL;
...@@ -448,7 +448,7 @@ template <typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::g ...@@ -448,7 +448,7 @@ template <typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::g
return arg; return arg;
} }
template <typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_header(const Char *&s, FormatSpec &spec) template<typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_header(const Char *&s, FormatSpec &spec)
{ {
unsigned arg_index = std::numeric_limits<unsigned>::max(); unsigned arg_index = std::numeric_limits<unsigned>::max();
Char c = *s; Char c = *s;
...@@ -489,7 +489,7 @@ template <typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_ ...@@ -489,7 +489,7 @@ template <typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_
return arg_index; return arg_index;
} }
template <typename Char, typename AF> void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str) template<typename Char, typename AF> void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str)
{ {
const Char *start = format_str.c_str(); const Char *start = format_str.c_str();
const Char *s = start; const Char *s = start;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#endif #endif
namespace fmt { namespace fmt {
template <typename ArgFormatter> void format_arg(BasicFormatter<char, ArgFormatter> &f, const char *&format_str, const std::tm &tm) template<typename ArgFormatter> void format_arg(BasicFormatter<char, ArgFormatter> &f, const char *&format_str, const std::tm &tm)
{ {
if (*format_str == ':') if (*format_str == ':')
++format_str; ++format_str;
......
...@@ -27,40 +27,40 @@ public: ...@@ -27,40 +27,40 @@ public:
logger(const std::string &name, sink_ptr single_sink); logger(const std::string &name, sink_ptr single_sink);
logger(const std::string &name, sinks_init_list sinks); logger(const std::string &name, sinks_init_list sinks);
template <class It> logger(std::string name, const It &begin, const It &end); template<class It> logger(std::string name, const It &begin, const It &end);
virtual ~logger(); virtual ~logger();
logger(const logger &) = delete; logger(const logger &) = delete;
logger &operator=(const logger &) = delete; logger &operator=(const logger &) = delete;
template <typename... Args> void log(level::level_enum lvl, const char *fmt, const Args &... args); template<typename... Args> void log(level::level_enum lvl, const char *fmt, const Args &... args);
template <typename... Args> void log(level::level_enum lvl, const char *msg); template<typename... Args> void log(level::level_enum lvl, const char *msg);
template <typename Arg1, typename... Args> void trace(const char *fmt, const Arg1 &, const Args &... args); template<typename Arg1, typename... Args> void trace(const char *fmt, const Arg1 &, const Args &... args);
template <typename Arg1, typename... Args> void debug(const char *fmt, const Arg1 &, const Args &... args); template<typename Arg1, typename... Args> void debug(const char *fmt, const Arg1 &, const Args &... args);
template <typename Arg1, typename... Args> void info(const char *fmt, const Arg1 &, const Args &... args); template<typename Arg1, typename... Args> void info(const char *fmt, const Arg1 &, const Args &... args);
template <typename Arg1, typename... Args> void warn(const char *fmt, const Arg1 &, const Args &... args); template<typename Arg1, typename... Args> void warn(const char *fmt, const Arg1 &, const Args &... args);
template <typename Arg1, typename... Args> void error(const char *fmt, const Arg1 &, const Args &... args); template<typename Arg1, typename... Args> void error(const char *fmt, const Arg1 &, const Args &... args);
template <typename Arg1, typename... Args> void critical(const char *fmt, const Arg1 &, const Args &... args); template<typename Arg1, typename... Args> void critical(const char *fmt, const Arg1 &, const Args &... args);
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template <typename... Args> void log(level::level_enum lvl, const wchar_t *msg); template<typename... Args> void log(level::level_enum lvl, const wchar_t *msg);
template <typename... Args> void log(level::level_enum lvl, const wchar_t *fmt, const Args &... args); template<typename... Args> void log(level::level_enum lvl, const wchar_t *fmt, const Args &... args);
template <typename... Args> void trace(const wchar_t *fmt, const Args &... args); template<typename... Args> void trace(const wchar_t *fmt, const Args &... args);
template <typename... Args> void debug(const wchar_t *fmt, const Args &... args); template<typename... Args> void debug(const wchar_t *fmt, const Args &... args);
template <typename... Args> void info(const wchar_t *fmt, const Args &... args); template<typename... Args> void info(const wchar_t *fmt, const Args &... args);
template <typename... Args> void warn(const wchar_t *fmt, const Args &... args); template<typename... Args> void warn(const wchar_t *fmt, const Args &... args);
template <typename... Args> void error(const wchar_t *fmt, const Args &... args); template<typename... Args> void error(const wchar_t *fmt, const Args &... args);
template <typename... Args> void critical(const wchar_t *fmt, const Args &... args); template<typename... Args> void critical(const wchar_t *fmt, const Args &... args);
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT #endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
template <typename T> void log(level::level_enum lvl, const T &); template<typename T> void log(level::level_enum lvl, const T &);
template <typename T> void trace(const T &msg); template<typename T> void trace(const T &msg);
template <typename T> void debug(const T &msg); template<typename T> void debug(const T &msg);
template <typename T> void info(const T &msg); template<typename T> void info(const T &msg);
template <typename T> void warn(const T &msg); template<typename T> void warn(const T &msg);
template <typename T> void error(const T &msg); template<typename T> void error(const T &msg);
template <typename T> void critical(const T &msg); template<typename T> void critical(const T &msg);
bool should_log(level::level_enum msg_level) const; bool should_log(level::level_enum msg_level) const;
void set_level(level::level_enum log_level); void set_level(level::level_enum log_level);
......
...@@ -19,7 +19,7 @@ namespace spdlog { namespace sinks { ...@@ -19,7 +19,7 @@ namespace spdlog { namespace sinks {
* of the message. * of the message.
* If no color terminal detected, omit the escape codes. * If no color terminal detected, omit the escape codes.
*/ */
template <class Mutex> class ansicolor_sink : public base_sink<Mutex> template<class Mutex> class ansicolor_sink : public base_sink<Mutex>
{ {
public: public:
explicit ansicolor_sink(FILE *file) explicit ansicolor_sink(FILE *file)
...@@ -106,7 +106,7 @@ protected: ...@@ -106,7 +106,7 @@ protected:
std::unordered_map<level::level_enum, std::string, level::level_hasher> colors_; std::unordered_map<level::level_enum, std::string, level::level_hasher> colors_;
}; };
template <class Mutex> class ansicolor_stdout_sink : public ansicolor_sink<Mutex> template<class Mutex> class ansicolor_stdout_sink : public ansicolor_sink<Mutex>
{ {
public: public:
ansicolor_stdout_sink() ansicolor_stdout_sink()
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
using ansicolor_stdout_sink_mt = ansicolor_stdout_sink<std::mutex>; using ansicolor_stdout_sink_mt = ansicolor_stdout_sink<std::mutex>;
using ansicolor_stdout_sink_st = ansicolor_stdout_sink<details::null_mutex>; using ansicolor_stdout_sink_st = ansicolor_stdout_sink<details::null_mutex>;
template <class Mutex> class ansicolor_stderr_sink : public ansicolor_sink<Mutex> template<class Mutex> class ansicolor_stderr_sink : public ansicolor_sink<Mutex>
{ {
public: public:
ansicolor_stderr_sink() ansicolor_stderr_sink()
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <mutex> #include <mutex>
namespace spdlog { namespace sinks { namespace spdlog { namespace sinks {
template <class Mutex> class base_sink : public sink template<class Mutex> class base_sink : public sink
{ {
public: public:
base_sink() = default; base_sink() = default;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// Distribution sink (mux). Stores a vector of sinks which get called when log is called // Distribution sink (mux). Stores a vector of sinks which get called when log is called
namespace spdlog { namespace sinks { namespace spdlog { namespace sinks {
template <class Mutex> class dist_sink : public base_sink<Mutex> template<class Mutex> class dist_sink : public base_sink<Mutex>
{ {
public: public:
explicit dist_sink() explicit dist_sink()
......
...@@ -22,7 +22,7 @@ namespace spdlog { namespace sinks { ...@@ -22,7 +22,7 @@ namespace spdlog { namespace sinks {
/* /*
* Trivial file sink with single file as target * Trivial file sink with single file as target
*/ */
template <class Mutex> class simple_file_sink SPDLOG_FINAL : public base_sink<Mutex> template<class Mutex> class simple_file_sink SPDLOG_FINAL : public base_sink<Mutex>
{ {
public: public:
explicit simple_file_sink(const filename_t &filename, bool truncate = false) explicit simple_file_sink(const filename_t &filename, bool truncate = false)
...@@ -60,7 +60,7 @@ using simple_file_sink_st = simple_file_sink<details::null_mutex>; ...@@ -60,7 +60,7 @@ using simple_file_sink_st = simple_file_sink<details::null_mutex>;
/* /*
* Rotating file sink based on size * Rotating file sink based on size
*/ */
template <class Mutex> class rotating_file_sink SPDLOG_FINAL : public base_sink<Mutex> template<class Mutex> class rotating_file_sink SPDLOG_FINAL : public base_sink<Mutex>
{ {
public: public:
rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files) rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files)
...@@ -185,7 +185,7 @@ struct dateonly_daily_file_name_calculator ...@@ -185,7 +185,7 @@ struct dateonly_daily_file_name_calculator
/* /*
* Rotating file sink based on date. rotates at midnight * Rotating file sink based on date. rotates at midnight
*/ */
template <class Mutex, class FileNameCalc = default_daily_file_name_calculator> class daily_file_sink SPDLOG_FINAL : public base_sink<Mutex> template<class Mutex, class FileNameCalc = default_daily_file_name_calculator> class daily_file_sink SPDLOG_FINAL : public base_sink<Mutex>
{ {
public: public:
// create daily file sink which rotates on given time // create daily file sink which rotates on given time
......
...@@ -19,7 +19,7 @@ namespace spdlog { namespace sinks { ...@@ -19,7 +19,7 @@ namespace spdlog { namespace sinks {
/* /*
* MSVC sink (logging using OutputDebugStringA) * MSVC sink (logging using OutputDebugStringA)
*/ */
template <class Mutex> class msvc_sink : public base_sink<Mutex> template<class Mutex> class msvc_sink : public base_sink<Mutex>
{ {
public: public:
explicit msvc_sink() {} explicit msvc_sink() {}
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
namespace spdlog { namespace sinks { namespace spdlog { namespace sinks {
template <class Mutex> class null_sink : public base_sink<Mutex> template<class Mutex> class null_sink : public base_sink<Mutex>
{ {
protected: protected:
void _sink_it(const details::log_msg &) override {} void _sink_it(const details::log_msg &) override {}
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <ostream> #include <ostream>
namespace spdlog { namespace sinks { namespace spdlog { namespace sinks {
template <class Mutex> class ostream_sink : public base_sink<Mutex> template<class Mutex> class ostream_sink : public base_sink<Mutex>
{ {
public: public:
explicit ostream_sink(std::ostream &os, bool force_flush = false) explicit ostream_sink(std::ostream &os, bool force_flush = false)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace spdlog { namespace sinks { namespace spdlog { namespace sinks {
template <class Mutex> class stdout_sink SPDLOG_FINAL : public base_sink<Mutex> template<class Mutex> class stdout_sink SPDLOG_FINAL : public base_sink<Mutex>
{ {
using MyType = stdout_sink<Mutex>; using MyType = stdout_sink<Mutex>;
...@@ -43,7 +43,7 @@ protected: ...@@ -43,7 +43,7 @@ protected:
using stdout_sink_mt = stdout_sink<std::mutex>; using stdout_sink_mt = stdout_sink<std::mutex>;
using stdout_sink_st = stdout_sink<details::null_mutex>; using stdout_sink_st = stdout_sink<details::null_mutex>;
template <class Mutex> class stderr_sink SPDLOG_FINAL : public base_sink<Mutex> template<class Mutex> class stderr_sink SPDLOG_FINAL : public base_sink<Mutex>
{ {
using MyType = stderr_sink<Mutex>; using MyType = stderr_sink<Mutex>;
......
...@@ -18,7 +18,7 @@ namespace spdlog { namespace sinks { ...@@ -18,7 +18,7 @@ namespace spdlog { namespace sinks {
/* /*
* Windows color console sink. Uses WriteConsoleA to write to the console with colors * Windows color console sink. Uses WriteConsoleA to write to the console with colors
*/ */
template <class Mutex> class wincolor_sink : public base_sink<Mutex> template<class Mutex> class wincolor_sink : public base_sink<Mutex>
{ {
public: public:
const WORD BOLD = FOREGROUND_INTENSITY; const WORD BOLD = FOREGROUND_INTENSITY;
...@@ -89,7 +89,7 @@ private: ...@@ -89,7 +89,7 @@ private:
// //
// windows color console to stdout // windows color console to stdout
// //
template <class Mutex> class wincolor_stdout_sink : public wincolor_sink<Mutex> template<class Mutex> class wincolor_stdout_sink : public wincolor_sink<Mutex>
{ {
public: public:
wincolor_stdout_sink() wincolor_stdout_sink()
...@@ -104,7 +104,7 @@ using wincolor_stdout_sink_st = wincolor_stdout_sink<details::null_mutex>; ...@@ -104,7 +104,7 @@ using wincolor_stdout_sink_st = wincolor_stdout_sink<details::null_mutex>;
// //
// windows color console to stderr // windows color console to stderr
// //
template <class Mutex> class wincolor_stderr_sink : public wincolor_sink<Mutex> template<class Mutex> class wincolor_stderr_sink : public wincolor_sink<Mutex>
{ {
public: public:
wincolor_stderr_sink() wincolor_stderr_sink()
......
...@@ -14,7 +14,7 @@ namespace spdlog { namespace sinks { ...@@ -14,7 +14,7 @@ namespace spdlog { namespace sinks {
/* /*
* Windows debug sink (logging using OutputDebugStringA, synonym for msvc_sink) * Windows debug sink (logging using OutputDebugStringA, synonym for msvc_sink)
*/ */
template <class Mutex> using windebug_sink = msvc_sink<Mutex>; template<class Mutex> using windebug_sink = msvc_sink<Mutex>;
using windebug_sink_mt = msvc_sink_mt; using windebug_sink_mt = msvc_sink_mt;
using windebug_sink_st = msvc_sink_st; using windebug_sink_st = msvc_sink_st;
......
...@@ -122,12 +122,12 @@ std::shared_ptr<logger> create(const std::string &logger_name, const sink_ptr &s ...@@ -122,12 +122,12 @@ std::shared_ptr<logger> create(const std::string &logger_name, const sink_ptr &s
// Create and register a logger with multiple sinks // Create and register a logger with multiple sinks
std::shared_ptr<logger> create(const std::string &logger_name, sinks_init_list sinks); std::shared_ptr<logger> create(const std::string &logger_name, sinks_init_list sinks);
template <class It> std::shared_ptr<logger> create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end); template<class It> std::shared_ptr<logger> create(const std::string &logger_name, const It &sinks_begin, const It &sinks_end);
// Create and register a logger with templated sink type // Create and register a logger with templated sink type
// Example: // Example:
// spdlog::create<daily_file_sink_st>("mylog", "dailylog_filename"); // spdlog::create<daily_file_sink_st>("mylog", "dailylog_filename");
template <typename Sink, typename... Args> std::shared_ptr<spdlog::logger> create(const std::string &logger_name, Args... args); template<typename Sink, typename... Args> std::shared_ptr<spdlog::logger> create(const std::string &logger_name, Args... args);
// Create and register an async logger with a single sink // Create and register an async logger with a single sink
std::shared_ptr<logger> create_async(const std::string &logger_name, const sink_ptr &sink, size_t queue_size, std::shared_ptr<logger> create_async(const std::string &logger_name, const sink_ptr &sink, size_t queue_size,
...@@ -142,7 +142,7 @@ std::shared_ptr<logger> create_async(const std::string &logger_name, sinks_init_ ...@@ -142,7 +142,7 @@ std::shared_ptr<logger> create_async(const std::string &logger_name, sinks_init_
const std::function<void()> &worker_warmup_cb = nullptr, const std::function<void()> &worker_warmup_cb = nullptr,
const std::chrono::milliseconds &flush_interval_ms = std::chrono::milliseconds::zero(), const std::chrono::milliseconds &flush_interval_ms = std::chrono::milliseconds::zero(),
const std::function<void()> &worker_teardown_cb = nullptr); const std::function<void()> &worker_teardown_cb = nullptr);
template <class It> template<class It>
std::shared_ptr<logger> create_async(const std::string &logger_name, const It &sinks_begin, const It &sinks_end, size_t queue_size, std::shared_ptr<logger> create_async(const std::string &logger_name, const It &sinks_begin, const It &sinks_end, size_t queue_size,
const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
const std::function<void()> &worker_warmup_cb = nullptr, const std::function<void()> &worker_warmup_cb = nullptr,
......
#include "includes.h" #include "includes.h"
template <class T> std::string log_info(const T &what, spdlog::level::level_enum logger_level = spdlog::level::info) template<class T> std::string log_info(const T &what, spdlog::level::level_enum logger_level = spdlog::level::info)
{ {
std::ostringstream oss; std::ostringstream oss;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment