Changed clang formatting for templates

This commit is contained in:
gabime 2018-03-16 17:13:50 +02:00
parent f4ce52d206
commit 5afb5dc782
29 changed files with 291 additions and 288 deletions

View File

@ -24,6 +24,12 @@ void err_handler_example();
namespace spd = spdlog; namespace spd = spdlog;
int main(int, char *[]) int main(int, char *[])
{ {
fmt::MemoryWriter w;
w.write("HELLO", 10);
std::string s(w.data(), w.size());
std::cout << s << std::endl;
return 0;
try try
{ {
// Console logger with color // Console logger with color

View File

@ -345,8 +345,7 @@ typedef __int64 intmax_t;
#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED) #if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && !defined(_MANAGED)
#include <intrin.h> // _BitScanReverse, _BitScanReverse64 #include <intrin.h> // _BitScanReverse, _BitScanReverse64
namespace fmt { namespace fmt { namespace internal {
namespace internal {
// avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning // avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning
#ifndef __clang__ #ifndef __clang__
#pragma intrinsic(_BitScanReverse) #pragma intrinsic(_BitScanReverse)
@ -392,8 +391,7 @@ inline uint32_t clzll(uint64_t x)
return 63 - r; return 63 - r;
} }
#define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n) #define FMT_BUILTIN_CLZLL(n) fmt::internal::clzll(n)
} }} // namespace fmt::internal
} // namespace fmt
#endif #endif
namespace fmt { namespace internal { namespace fmt { namespace internal {
@ -1646,8 +1644,7 @@ public:
int_value = value; int_value = value;
} }
template <typename T, typename = typename std::enable_if<std::is_enum<T>::value && ConvertToInt<T>::value>::type> template<typename T, typename = typename std::enable_if<std::is_enum<T>::value && ConvertToInt<T>::value>::type> static uint64_t type(T)
static uint64_t type(T)
{ {
return Arg::INT; return Arg::INT;
} }
@ -2899,8 +2896,9 @@ inline uint64_t make_type(FMT_GEN15(FMT_ARG_TYPE_DEFAULT))
FMT_WRAP1(func, arg_type, 2) \ FMT_WRAP1(func, arg_type, 2) \
FMT_WRAP1(func, arg_type, 3) \ FMT_WRAP1(func, arg_type, 3) \
FMT_WRAP1(func, arg_type, 4) \ FMT_WRAP1(func, arg_type, 4) \
FMT_WRAP1(func, arg_type, 5) FMT_WRAP1(func, arg_type, 6) FMT_WRAP1(func, arg_type, 7) FMT_WRAP1(func, arg_type, 8) \ FMT_WRAP1(func, arg_type, 5) \
FMT_WRAP1(func, arg_type, 9) FMT_WRAP1(func, arg_type, 10) FMT_WRAP1(func, arg_type, 6) \
FMT_WRAP1(func, arg_type, 7) FMT_WRAP1(func, arg_type, 8) FMT_WRAP1(func, arg_type, 9) FMT_WRAP1(func, arg_type, 10)
#define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \ #define FMT_CTOR(ctor, func, arg0_type, arg1_type, n) \
template<FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) \ template<FMT_GEN(n, FMT_MAKE_TEMPLATE_ARG)> ctor(arg0_type arg0, arg1_type arg1, FMT_GEN(n, FMT_MAKE_ARG)) \
@ -4646,8 +4644,7 @@ template <typename Range> auto join(const Range &range, const BasicCStringRef<ch
return join(std::begin(range), std::end(range), sep); return join(std::begin(range), std::end(range), sep);
} }
template <typename Range> template<typename Range> auto join(const Range &range, const BasicCStringRef<wchar_t> &sep) -> ArgJoin<wchar_t, decltype(std::begin(range))>
auto join(const Range &range, const BasicCStringRef<wchar_t> &sep) -> ArgJoin<wchar_t, decltype(std::begin(range))>
{ {
return join(std::begin(range), std::end(range), sep); return join(std::begin(range), std::end(range), sep);
} }