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