Commit 4445f6f8 authored by gabime's avatar gabime

formatting

parent 4ee89877
......@@ -13,7 +13,8 @@
#include "g2logworker.h"
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[])
{
......
......@@ -11,7 +11,8 @@
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("");
std::stringstream ss;
......@@ -20,7 +21,8 @@ template<typename T> 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;
......
......@@ -11,7 +11,8 @@
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("");
std::stringstream ss;
......@@ -20,7 +21,8 @@ template<typename T> 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;
......
......@@ -133,7 +133,8 @@ void android_example()
struct my_type
{
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 << "]";
}
......
......@@ -133,7 +133,8 @@ void android_example()
struct my_type
{
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 << "]";
}
......
......@@ -11,7 +11,8 @@
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("");
std::stringstream ss;
......@@ -20,7 +21,8 @@ template<typename T> 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;
......
......@@ -50,7 +50,8 @@ inline void spdlog::logger::set_pattern(const std::string &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))
return;
......@@ -77,7 +78,8 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
}
}
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))
return;
......@@ -98,7 +100,8 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
}
}
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))
return;
......@@ -119,62 +122,74 @@ template<typename T> inline void spdlog::logger::log(level::level_enum lvl, cons
}
}
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...);
}
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...);
}
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...);
}
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...);
}
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...);
}
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...);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
......@@ -183,14 +198,16 @@ template<typename T> inline void spdlog::logger::critical(const T &msg)
#include <codecvt>
#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;
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;
......@@ -198,32 +215,38 @@ template<typename... Args> inline void spdlog::logger::log(level::level_enum lvl
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...);
}
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...);
}
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...);
}
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...);
}
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...);
}
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...);
}
......
......@@ -50,7 +50,8 @@ Distributed under the MIT License (http://opensource.org/licenses/MIT)
namespace spdlog { namespace details {
template<typename T> class mpmc_bounded_queue
template<typename T>
class mpmc_bounded_queue
{
public:
using item_type = T;
......
......@@ -23,7 +23,8 @@
#include <unordered_map>
namespace spdlog { namespace details {
template<class Mutex> class registry_t
template<class Mutex>
class registry_t
{
public:
registry_t<Mutex>(const registry_t<Mutex> &) = delete;
......@@ -44,7 +45,8 @@ public:
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);
throw_if_exists(logger_name);
......
......@@ -434,7 +434,8 @@ inline DummyInt _isnan(...)
// A helper function to suppress bogus "conditional expression is constant"
// warnings.
template<typename T> inline T const_check(T value)
template<typename T>
inline T const_check(T value)
{
return value;
}
......@@ -445,11 +446,13 @@ 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<fmt::internal::DummyInt> : public std::numeric_limits<int>
template<>
class numeric_limits<fmt::internal::DummyInt> : public std::numeric_limits<int>
{
public:
// Portable version of isinf.
template<typename T> static bool isinfinity(T x)
template<typename T>
static bool isinfinity(T x)
{
using namespace fmt::internal;
// The resolution "priority" is:
......@@ -462,7 +465,8 @@ public:
}
// Portable version of isnan.
template<typename T> static bool isnotanumber(T x)
template<typename T>
static bool isnotanumber(T x)
{
using namespace fmt::internal;
if (const_check(sizeof(isnan(x)) == sizeof(bool) || sizeof(isnan(x)) == sizeof(int)))
......@@ -503,18 +507,22 @@ FMT_GCC_EXTENSION typedef unsigned long long ULongLong;
using std::move;
#endif
template<typename Char> class BasicWriter;
template<typename Char>
class BasicWriter;
typedef BasicWriter<char> Writer;
typedef BasicWriter<wchar_t> WWriter;
template<typename Char> class ArgFormatter;
template<typename Char>
class ArgFormatter;
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
......@@ -541,7 +549,8 @@ template<typename CharType, typename ArgFormatter = fmt::ArgFormatter<CharType>>
format(std::string("{}"), 42);
\endrst
*/
template<typename Char> class BasicStringRef
template<typename Char>
class BasicStringRef
{
private:
const Char *data_;
......@@ -688,7 +697,8 @@ typedef BasicStringRef<wchar_t> WStringRef;
format(std::string("{}"), 42);
\endrst
*/
template<typename Char> class BasicCStringRef
template<typename Char>
class BasicCStringRef
{
private:
const Char *data_;
......@@ -739,13 +749,15 @@ public:
namespace internal {
// 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;
};
#define FMT_SPECIALIZE_MAKE_UNSIGNED(T, U) \
template<> struct MakeUnsigned<T> \
template<> \
struct MakeUnsigned<T> \
{ \
typedef U Type; \
}
......@@ -758,7 +770,8 @@ FMT_SPECIALIZE_MAKE_UNSIGNED(long, unsigned long);
FMT_SPECIALIZE_MAKE_UNSIGNED(LongLong, ULongLong);
// 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");
return static_cast<typename MakeUnsigned<Int>::Type>(value);
......@@ -773,12 +786,14 @@ enum
#if FMT_SECURE_SCL
// 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);
}
#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;
}
......@@ -790,7 +805,8 @@ template<typename T> inline T *make_ptr(T *ptr, std::size_t)
A buffer supporting a subset of ``std::vector``'s operations.
\endrst
*/
template<typename T> class Buffer
template<typename T>
class Buffer
{
private:
FMT_DISALLOW_COPY_AND_ASSIGN(Buffer);
......@@ -864,7 +880,8 @@ public:
}
/** 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)
{
......@@ -876,7 +893,9 @@ 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");
std::size_t new_size = size_ + static_cast<std::size_t>(end - begin);
......@@ -890,7 +909,8 @@ namespace internal {
// A memory buffer for trivially copyable/constructible types with the first
// 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:
T data_[SIZE];
......@@ -961,7 +981,8 @@ 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;
if (size > new_capacity)
......@@ -985,7 +1006,8 @@ template<typename T, std::size_t SIZE, typename Allocator> void MemoryBuffer<T,
}
// A fixed-size buffer.
template<typename Char> class FixedBuffer : public fmt::Buffer<Char>
template<typename Char>
class FixedBuffer : public fmt::Buffer<Char>
{
public:
FixedBuffer(Char *array, std::size_t size)
......@@ -997,7 +1019,8 @@ protected:
FMT_API void grow(std::size_t size) FMT_OVERRIDE;
};
template<typename Char> class BasicCharTraits
template<typename Char>
class BasicCharTraits
{
public:
#if FMT_SECURE_SCL
......@@ -1011,9 +1034,11 @@ 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:
// Conversion from wchar_t to char is not allowed.
......@@ -1037,7 +1062,8 @@ 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);
#endif
template<> class CharTraits<wchar_t> : public BasicCharTraits<wchar_t>
template<>
class CharTraits<wchar_t> : public BasicCharTraits<wchar_t>
{
public:
static wchar_t convert(char value)
......@@ -1061,17 +1087,21 @@ extern template int CharTraits<wchar_t>::format_float<long double>(
#endif
// 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;
}
};
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;
}
......@@ -1079,23 +1109,27 @@ template<> struct SignChecker<false>
// Returns true if value is negative, false otherwise.
// 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);
}
// Selects uint32_t if FitsIn32Bits is true, uint64_t otherwise.
template<bool FitsIn32Bits> struct TypeSelector
template<bool FitsIn32Bits>
struct TypeSelector
{
typedef uint32_t Type;
};
template<> struct TypeSelector<false>
template<>
struct TypeSelector<false>
{
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
// all values of T.
......@@ -1106,7 +1140,8 @@ 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<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 uint64_t POWERS_OF_10_64[];
......@@ -1165,7 +1200,10 @@ inline unsigned count_digits(uint32_t n)
// A functor that doesn't add a thousands separator.
struct NoThousandsSep
{
template<typename Char> void operator()(Char *) {}
template<typename Char>
void operator()(Char *)
{
}
};
// A functor that adds a thousands separator.
......@@ -1184,7 +1222,8 @@ public:
{
}
template<typename Char> void operator()(Char *&buffer)
template<typename Char>
void operator()(Char *&buffer)
{
if (++digit_index_ % 3 != 0)
return;
......@@ -1223,7 +1262,8 @@ inline void format_decimal(Char *buffer, UInt value, unsigned num_digits, Thousa
*--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());
return;
......@@ -1304,7 +1344,8 @@ FMT_API void format_windows_error(fmt::Writer &out, int error_code, fmt::StringR
// A formatting argument value.
struct Value
{
template<typename Char> struct StringValue
template<typename Char>
struct StringValue
{
const Char *value;
std::size_t size;
......@@ -1365,22 +1406,27 @@ struct Arg : Value
Type type;
};
template<typename Char> struct NamedArg;
template<typename Char, typename T> struct NamedArgWithType;
template<typename Char>
struct NamedArg;
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
// characters and strings in MakeValue.
template<typename T, typename Char> struct WCharHelper
template<typename T, typename Char>
struct WCharHelper
{
typedef Null<T> Supported;
typedef T Unsupported;
};
template<typename T> struct WCharHelper<T, wchar_t>
template<typename T>
struct WCharHelper<T, wchar_t>
{
typedef T Supported;
typedef Null<T> Unsupported;
......@@ -1389,13 +1435,15 @@ template<typename T> struct WCharHelper<T, wchar_t>
typedef char Yes[1];
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.
Yes &convert(fmt::ULongLong);
No &convert(...);
template<typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl
template<typename T, bool ENABLE_CONVERSION>
struct ConvertToIntImpl
{
enum
{
......@@ -1403,7 +1451,8 @@ 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
{
......@@ -1411,7 +1460,8 @@ template<typename T, bool ENABLE_CONVERSION> struct ConvertToIntImpl2
};
};
template<typename T> struct ConvertToIntImpl2<T, true>
template<typename T>
struct ConvertToIntImpl2<T, true>
{
enum
{
......@@ -1420,7 +1470,8 @@ template<typename T> struct ConvertToIntImpl2<T, true>
};
};
template<typename T> struct ConvertToInt
template<typename T>
struct ConvertToInt
{
enum
{
......@@ -1433,7 +1484,8 @@ template<typename T> struct ConvertToInt
};
#define FMT_DISABLE_CONVERSION_TO_INT(Type) \
template<> struct ConvertToInt<Type> \
template<> \
struct ConvertToInt<Type> \
{ \
enum \
{ \
......@@ -1446,27 +1498,32 @@ FMT_DISABLE_CONVERSION_TO_INT(float);
FMT_DISABLE_CONVERSION_TO_INT(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;
};
template<bool B, class T, class F> struct Conditional
template<bool B, class T, class F>
struct Conditional
{
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;
};
// For bcc32 which doesn't understand ! in template arguments.
template<bool> struct Not
template<bool>
struct Not
{
enum
{
......@@ -1474,7 +1531,8 @@ template<bool> struct Not
};
};
template<> struct Not<false>
template<>
struct Not<false>
{
enum
{
......@@ -1482,7 +1540,8 @@ template<> struct Not<false>
};
};
template<typename T> struct FalseType
template<typename T>
struct FalseType
{
enum
{
......@@ -1490,7 +1549,8 @@ template<typename T> struct FalseType
};
};
template<typename T, T> struct LConvCheck
template<typename T, T>
struct LConvCheck
{
LConvCheck(int) {}
};
......@@ -1498,7 +1558,8 @@ template<typename T, T> 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<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;
}
......@@ -1527,7 +1588,8 @@ inline fmt::StringRef thousands_sep(...)
#define FMT_STATIC_ASSERT(cond, message) typedef int FMT_CONCAT_(Assert, __LINE__)[(cond) ? 1 : -1] FMT_UNUSED
#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 "
"operator<< include fmt/ostream.h. Otherwise provide "
......@@ -1535,7 +1597,8 @@ template<typename Formatter> void format_arg(Formatter &, ...)
}
// Makes an Arg object from any type.
template<typename Formatter> class MakeValue : public Arg
template<typename Formatter>
class MakeValue : public Arg
{
public:
typedef typename Formatter::Char Char;
......@@ -1546,8 +1609,10 @@ 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<typename T> MakeValue(const T *value);
template<typename T> MakeValue(T *value);
template<typename T>
MakeValue(const T *value);
template<typename T>
MakeValue(T *value);
// The following methods are private to disallow formatting of wide
// characters and strings into narrow strings as in
......@@ -1577,7 +1642,8 @@ private:
}
// 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));
}
......@@ -1639,12 +1705,14 @@ public:
FMT_MAKE_VALUE(char, int_value, CHAR)
#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;
}
template<typename T, typename = typename std::enable_if<std::is_enum<T>::value && ConvertToInt<T>::value>::type> static uint64_t type(T)
template<typename T, typename = typename std::enable_if<std::is_enum<T>::value && ConvertToInt<T>::value>::type>
static uint64_t type(T)
{
return Arg::INT;
}
......@@ -1705,39 +1773,46 @@ public:
FMT_MAKE_VALUE(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.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;
}
// Additional template param `Char_` is needed here because make_type always
// uses char.
template<typename Char_> MakeValue(const NamedArg<Char_> &value)
template<typename Char_>
MakeValue(const NamedArg<Char_> &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;
}
template<typename Char_> static uint64_t type(const NamedArg<Char_> &)
template<typename Char_>
static uint64_t type(const NamedArg<Char_> &)
{
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;
}
};
template<typename Formatter> class MakeArg : public Arg
template<typename Formatter>
class MakeArg : public Arg
{
public:
MakeArg()
......@@ -1753,7 +1828,8 @@ public:
}
};
template<typename Char> struct NamedArg : Arg
template<typename Char>
struct NamedArg : Arg
{
BasicStringRef<Char> name;
......@@ -1765,7 +1841,8 @@ 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)
: NamedArg<Char>(argname, value)
......@@ -1787,7 +1864,8 @@ protected:
FMT_API ~RuntimeError() FMT_DTOR_NOEXCEPT FMT_OVERRIDE;
};
template<typename Char> class ArgMap;
template<typename Char>
class ArgMap;
} // namespace internal
/** An argument list. */
......@@ -1813,7 +1891,8 @@ private:
return type(types_, index);
}
template<typename Char> friend class internal::ArgMap;
template<typename Char>
friend class internal::ArgMap;
public:
// Maximum number of arguments with packed types.
......@@ -1907,7 +1986,8 @@ public:
};
\endrst
*/
template<typename Impl, typename Result> class ArgVisitor
template<typename Impl, typename Result>
class ArgVisitor
{
private:
typedef internal::Arg Arg;
......@@ -1958,7 +2038,8 @@ public:
}
/** 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());
}
......@@ -1976,7 +2057,8 @@ public:
}
/** 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());
}
......@@ -2083,7 +2165,8 @@ struct EmptySpec
};
// A type specifier.
template<char TYPE> struct TypeSpec : EmptySpec
template<char TYPE>
struct TypeSpec : EmptySpec
{
Alignment align() const
{
......@@ -2162,7 +2245,8 @@ struct AlignSpec : WidthSpec
};
// An alignment and type specifier.
template<char TYPE> struct AlignTypeSpec : AlignSpec
template<char TYPE>
struct AlignTypeSpec : AlignSpec
{
AlignTypeSpec(unsigned width, wchar_t fill)
: AlignSpec(width, fill)
......@@ -2217,7 +2301,8 @@ struct FormatSpec : AlignSpec
};
// 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:
T value_;
......@@ -2236,7 +2321,8 @@ public:
};
// A string format specifier.
template<typename Char> class StrFormatSpec : public AlignSpec
template<typename Char>
class StrFormatSpec : public AlignSpec
{
private:
const Char *str_;
......@@ -2292,7 +2378,8 @@ IntFormatSpec<int, TypeSpec<'X'>> hexu(int value);
\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) \
inline IntFormatSpec<TYPE, TypeSpec<'b'>> bin(TYPE value) \
......@@ -2337,7 +2424,8 @@ template<char TYPE_CODE, typename Char> IntFormatSpec<int, AlignTypeSpec<TYPE_CO
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)); \
}
......@@ -2361,7 +2449,8 @@ FMT_DEFINE_INT_FORMATTERS(ULongLong)
\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);
}
......@@ -2373,7 +2462,8 @@ inline StrFormatSpec<wchar_t> pad(const wchar_t *str, unsigned width, char fill
namespace internal {
template<typename Char> class ArgMap
template<typename Char>
class ArgMap
{
private:
typedef std::vector<std::pair<fmt::BasicStringRef<Char>, internal::Arg>> MapType;
......@@ -2396,7 +2486,8 @@ public:
}
};
template<typename Char> void ArgMap<Char>::init(const ArgList &args)
template<typename Char>
void ArgMap<Char>::init(const ArgList &args)
{
if (!map_.empty())
return;
......@@ -2449,7 +2540,8 @@ 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:
BasicWriter<Char> &writer_;
......@@ -2499,12 +2591,14 @@ public:
{
}
template<typename T> void visit_any_int(T value)
template<typename T>
void visit_any_int(T value)
{
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_);
}
......@@ -2633,7 +2727,8 @@ protected:
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)
w << BasicStringRef<Char>(start, internal::to_unsigned(end - start));
......@@ -2689,7 +2784,8 @@ public:
};
/** 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:
/** Constructs an argument formatter object. */
......@@ -2700,7 +2796,8 @@ public:
};
/** 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:
/** The character type for the output. */
......@@ -2776,19 +2873,23 @@ inline uint64_t make_type()
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);
}
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.
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__
Value result = MakeValue<Formatter>(value);
......@@ -2802,18 +2903,21 @@ 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
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);
}
};
#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);
}
......@@ -2856,7 +2960,8 @@ 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<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; \
typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \
......@@ -2865,7 +2970,8 @@ 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<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; \
typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \
......@@ -2880,7 +2986,8 @@ 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<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)}; \
func(arg1, fmt::ArgList(fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \
......@@ -2901,7 +3008,8 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT))
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<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)}; \
func(arg0, arg1, fmt::ArgList(fmt::internal::make_type(FMT_GEN(n, FMT_MAKE_REF2)), array)); \
......@@ -3020,7 +3128,8 @@ FMT_API void format_system_error(fmt::Writer &out, int error_code, fmt::StringRe
\endrst
*/
template<typename Char> class BasicWriter
template<typename Char>
class BasicWriter
{
private:
// Output buffer.
......@@ -3057,7 +3166,8 @@ private:
}
// 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);
Char *ptr = get(grow_buffer(prefix_size + num_digits));
......@@ -3066,7 +3176,8 @@ private:
}
// 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;
MainType abs_value = static_cast<MainType>(value);
......@@ -3090,18 +3201,23 @@ private:
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.
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).
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.
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
// and strings to a char stream. If you want to print a wide string as a
......@@ -3117,11 +3233,16 @@ private:
*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:
/**
......@@ -3296,14 +3417,16 @@ public:
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());
write_int(spec.value(), spec);
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();
write_str(s, std::char_traits<Char>::length(s), spec);
......@@ -3463,7 +3586,9 @@ typename BasicWriter<Char>::CharPtr BasicWriter<Char>::prepare_int_buffer(
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;
typedef typename internal::IntTraits<T>::MainType UnsignedType;
......@@ -3571,7 +3696,9 @@ template<typename Char> template<typename T, typename Spec> void BasicWriter<Cha
}
}
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.
char type = spec.type();
......@@ -3789,7 +3916,8 @@ template<typename Char> template<typename T, typename Spec> void BasicWriter<Cha
accessed as a C string with ``out.c_str()``.
\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:
internal::MemoryBuffer<Char, internal::INLINE_BUFFER_SIZE, Allocator> buffer_;
......@@ -3850,7 +3978,8 @@ typedef BasicMemoryWriter<wchar_t> WMemoryWriter;
+--------------+---------------------------+
\endrst
*/
template<typename Char> class BasicArrayWriter : public BasicWriter<Char>
template<typename Char>
class BasicArrayWriter : public BasicWriter<Char>
{
private:
internal::FixedBuffer<Char> buffer_;
......@@ -4120,7 +4249,8 @@ 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<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;
MainType abs_value = static_cast<MainType>(value);
......@@ -4156,20 +4286,24 @@ template<typename T> inline void format_decimal(char *&buffer, T value)
\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);
}
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);
}
// The following two functions are deleted intentionally to disable
// 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(WStringRef, 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;
} // namespace fmt
#if FMT_GCC_VERSION
......@@ -4198,7 +4332,8 @@ template<typename Char> void arg(WStringRef, const internal::NamedArg<Char> &) F
#if FMT_USE_VARIADIC_TEMPLATES
#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; \
typename ArgArray::Type array{ArgArray::template make<fmt::BasicFormatter<Char>>(args)...}; \
......@@ -4303,14 +4438,16 @@ FMT_VARIADIC(void, print, std::FILE *, CStringRef)
FMT_VARIADIC(void, print_colored, Color, CStringRef)
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;
}
// 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<typename Char> unsigned parse_nonnegative_int(const Char *&s)
template<typename Char>
unsigned parse_nonnegative_int(const Char *&s)
{
assert('0' <= *s && *s <= '9');
unsigned value = 0;
......@@ -4343,7 +4480,8 @@ 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);
require_numeric_argument(arg, sign);
......@@ -4369,7 +4507,8 @@ inline internal::Arg BasicFormatter<Char, AF>::get_arg(BasicStringRef<Char> 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;
internal::Arg arg = *s < '0' || *s > '9' ? next_arg(error) : get_arg(internal::parse_nonnegative_int(s), error);
......@@ -4380,7 +4519,8 @@ template<typename Char, typename AF> inline internal::Arg BasicFormatter<Char, A
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));
const Char *start = s;
......@@ -4590,7 +4730,8 @@ const Char *BasicFormatter<Char, ArgFormatter>::format(const Char *&format_str,
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 *start = s;
......@@ -4614,7 +4755,8 @@ template<typename Char, typename AF> void BasicFormatter<Char, AF>::format(Basic
write(writer_, start, s);
}
template<typename Char, typename It> struct ArgJoin
template<typename Char, typename It>
struct ArgJoin
{
It first;
It last;
......@@ -4628,23 +4770,27 @@ 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);
}
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);
}
#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);
}
template<typename Range> auto join(const Range &range, const BasicCStringRef<wchar_t> &sep) -> ArgJoin<wchar_t, decltype(std::begin(range))>
template<typename 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);
}
......@@ -4681,21 +4827,25 @@ void format_arg(fmt::BasicFormatter<Char, ArgFormatter> &f, const Char *&format_
namespace fmt {
namespace internal {
template<typename Char> struct UdlFormat
template<typename Char>
struct UdlFormat
{
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)...);
}
};
template<typename Char> struct UdlArg
template<typename Char>
struct UdlArg
{
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)};
}
......
......@@ -17,7 +17,8 @@ namespace fmt {
namespace internal {
template<class Char> class FormatBuf : public std::basic_streambuf<Char>
template<class Char>
class FormatBuf : public std::basic_streambuf<Char>
{
private:
typedef typename std::basic_streambuf<Char>::int_type int_type;
......@@ -60,12 +61,14 @@ struct DummyStream : std::ostream
DummyStream(); // Suppress a bogus warning in MSVC.
// 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);
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<<.
enum
......
......@@ -20,9 +20,11 @@ namespace internal {
// Checks if a value fits in int - used to avoid warnings about comparing
// 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();
return value <= max;
......@@ -33,9 +35,11 @@ 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();
}
......@@ -53,7 +57,8 @@ public:
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))
FMT_THROW(FormatError("number is too big"));
......@@ -65,7 +70,8 @@ public:
class IsZeroInt : public ArgVisitor<IsZeroInt, bool>
{
public:
template<typename T> bool visit_any_int(T value)
template<typename T>
bool visit_any_int(T value)
{
return value == 0;
}
......@@ -90,12 +96,14 @@ public:
return 'p';
}
template<typename T> char visit_any_int(T)
template<typename T>
char visit_any_int(T)
{
return 'd';
}
template<typename T> char visit_any_double(T)
template<typename T>
char visit_any_double(T)
{
return 'g';
}
......@@ -106,7 +114,8 @@ public:
}
};
template<typename T, typename U> struct is_same
template<typename T, typename U>
struct is_same
{
enum
{
......@@ -114,7 +123,8 @@ 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
{
......@@ -126,7 +136,8 @@ template<typename T> struct is_same<T, T>
// 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<typename T = void> class ArgConverter : public ArgVisitor<ArgConverter<T>, void>
template<typename T = void>
class ArgConverter : public ArgVisitor<ArgConverter<T>, void>
{
private:
internal::Arg &arg_;
......@@ -153,7 +164,8 @@ public:
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';
if (type_ == 's')
......@@ -211,7 +223,8 @@ 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_.int_value = static_cast<char>(value);
......@@ -238,7 +251,8 @@ public:
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;
UnsignedType width = static_cast<UnsignedType>(value);
......@@ -272,7 +286,8 @@ public:
superclass will be called.
\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:
void write_null_pointer()
......@@ -367,7 +382,8 @@ public:
};
/** 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:
/** Constructs an argument formatter object. */
......@@ -378,7 +394,8 @@ public:
};
/** 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:
BasicWriter<Char> &writer_;
......@@ -410,7 +427,8 @@ public:
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 (;;)
{
......@@ -438,7 +456,8 @@ template<typename Char, typename AF> void PrintfFormatter<Char, AF>::parse_flags
}
}
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;
const char *error = FMT_NULL;
......@@ -448,7 +467,8 @@ template<typename Char, typename AF> internal::Arg PrintfFormatter<Char, AF>::ge
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();
Char c = *s;
......@@ -489,7 +509,8 @@ template<typename Char, typename AF> unsigned PrintfFormatter<Char, AF>::parse_h
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 *s = start;
......
......@@ -20,7 +20,8 @@
#endif
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 == ':')
++format_str;
......
......@@ -27,40 +27,84 @@ public:
logger(const std::string &name, sink_ptr single_sink);
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();
logger(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 *msg);
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 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 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... 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 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 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 error(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
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 trace(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 warn(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 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 trace(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 warn(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);
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
template<typename T>
void log(level::level_enum lvl, const T &);
template<typename T>
void trace(const T &msg);
template<typename T>
void debug(const T &msg);
template<typename T>
void info(const T &msg);
template<typename T>
void warn(const T &msg);
template<typename T>
void error(const T &msg);
template<typename T> void log(level::level_enum lvl, const T &);
template<typename T> void trace(const T &msg);
template<typename T> void debug(const T &msg);
template<typename T> void info(const T &msg);
template<typename T> void warn(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;
void set_level(level::level_enum log_level);
......
......@@ -19,7 +19,8 @@ namespace spdlog { namespace sinks {
* of the message.
* 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:
explicit ansicolor_sink(FILE *file)
......@@ -106,7 +107,8 @@ protected:
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:
ansicolor_stdout_sink()
......@@ -118,7 +120,8 @@ public:
using ansicolor_stdout_sink_mt = ansicolor_stdout_sink<std::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:
ansicolor_stderr_sink()
......
......@@ -18,7 +18,8 @@
#include <mutex>
namespace spdlog { namespace sinks {
template<class Mutex> class base_sink : public sink
template<class Mutex>
class base_sink : public sink
{
public:
base_sink() = default;
......
......@@ -18,7 +18,8 @@
// Distribution sink (mux). Stores a vector of sinks which get called when log is called
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:
explicit dist_sink()
......
......@@ -22,7 +22,8 @@ namespace spdlog { namespace sinks {
/*
* 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:
explicit simple_file_sink(const filename_t &filename, bool truncate = false)
......@@ -60,7 +61,8 @@ using simple_file_sink_st = simple_file_sink<details::null_mutex>;
/*
* 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:
rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files)
......@@ -185,7 +187,8 @@ struct dateonly_daily_file_name_calculator
/*
* 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:
// create daily file sink which rotates on given time
......
......@@ -19,7 +19,8 @@ namespace spdlog { namespace sinks {
/*
* 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:
explicit msvc_sink() {}
......
......@@ -12,7 +12,8 @@
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:
void _sink_it(const details::log_msg &) override {}
......
......@@ -12,7 +12,8 @@
#include <ostream>
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:
explicit ostream_sink(std::ostream &os, bool force_flush = false)
......
......@@ -14,7 +14,8 @@
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>;
......@@ -43,7 +44,8 @@ protected:
using stdout_sink_mt = stdout_sink<std::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>;
......
......@@ -18,7 +18,8 @@ namespace spdlog { namespace sinks {
/*
* 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:
const WORD BOLD = FOREGROUND_INTENSITY;
......@@ -89,7 +90,8 @@ private:
//
// 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:
wincolor_stdout_sink()
......@@ -104,7 +106,8 @@ using wincolor_stdout_sink_st = wincolor_stdout_sink<details::null_mutex>;
//
// 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:
wincolor_stderr_sink()
......
......@@ -14,7 +14,8 @@ namespace spdlog { namespace sinks {
/*
* 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_st = msvc_sink_st;
......
......@@ -81,6 +81,7 @@ std::shared_ptr<logger> basic_logger_st(const std::string &logger_name, const fi
//
std::shared_ptr<logger> rotating_logger_mt(
const std::string &logger_name, const filename_t &filename, size_t max_file_size, size_t max_files);
std::shared_ptr<logger> rotating_logger_st(
const std::string &logger_name, const filename_t &filename, size_t max_file_size, size_t max_files);
......@@ -122,12 +123,15 @@ std::shared_ptr<logger> create(const std::string &logger_name, const sink_ptr &s
// Create and register a logger with multiple 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
// Example:
// 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
std::shared_ptr<logger> create_async(const std::string &logger_name, const sink_ptr &sink, size_t queue_size,
......@@ -142,6 +146,7 @@ std::shared_ptr<logger> create_async(const std::string &logger_name, sinks_init_
const std::function<void()> &worker_warmup_cb = nullptr,
const std::chrono::milliseconds &flush_interval_ms = std::chrono::milliseconds::zero(),
const std::function<void()> &worker_teardown_cb = nullptr);
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,
const async_overflow_policy overflow_policy = async_overflow_policy::block_retry,
......
#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;
......
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