diff options
| author | Per Larsson <[email protected]> | 2022-01-22 11:11:34 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2022-01-22 11:11:34 +0100 |
| commit | aef9c292beae2245da35f60fa8c8bd9c52fd248f (patch) | |
| tree | 798c254a0a3c867b5bc79c676684de7d47de6cc9 /zencore/include | |
| parent | Use ExtendablePathBuilders (diff) | |
| download | zen-aef9c292beae2245da35f60fa8c8bd9c52fd248f.tar.xz zen-aef9c292beae2245da35f60fa8c8bd9c52fd248f.zip | |
Format fix.
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/except.h | 2 | ||||
| -rw-r--r-- | zencore/include/zencore/memory.h | 6 | ||||
| -rw-r--r-- | zencore/include/zencore/string.h | 6 | ||||
| -rw-r--r-- | zencore/include/zencore/zencore.h | 53 |
4 files changed, 42 insertions, 25 deletions
diff --git a/zencore/include/zencore/except.h b/zencore/include/zencore/except.h index d714b6ade..c61db5ba9 100644 --- a/zencore/include/zencore/except.h +++ b/zencore/include/zencore/except.h @@ -22,7 +22,7 @@ ZENCORE_API void ThrowSystemException [[noreturn]] (HRESULT hRes, std::string_vi #if defined(__cpp_lib_source_location) ZENCORE_API void ThrowLastErrorImpl [[noreturn]] (std::string_view Message, const std::source_location& Location); -#define ThrowLastError(Message) ThrowLastErrorImpl(Message, std::source_location::current()) +# define ThrowLastError(Message) ThrowLastErrorImpl(Message, std::source_location::current()) #else ZENCORE_API void ThrowLastError [[noreturn]] (std::string_view Message); #endif diff --git a/zencore/include/zencore/memory.h b/zencore/include/zencore/memory.h index 40a3be18c..560fa9ffc 100644 --- a/zencore/include/zencore/memory.h +++ b/zencore/include/zencore/memory.h @@ -15,9 +15,11 @@ namespace zen { #if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L - template <typename T> concept ContiguousRange = std::ranges::contiguous_range<T>; +template<typename T> +concept ContiguousRange = std::ranges::contiguous_range<T>; #else - template <typename T> concept ContiguousRange = true; +template<typename T> +concept ContiguousRange = true; #endif struct MemoryView; diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h index 1afacc089..1e8907906 100644 --- a/zencore/include/zencore/string.h +++ b/zencore/include/zencore/string.h @@ -664,9 +664,9 @@ template<typename Fn> uint32_t ForEachStrTok(const std::string_view& Str, char Delim, Fn&& Func) { - const char* It = Str.data(); - const char* End = It + Str.length(); - uint32_t Count = 0; + const char* It = Str.data(); + const char* End = It + Str.length(); + uint32_t Count = 0; while (It != End) { diff --git a/zencore/include/zencore/zencore.h b/zencore/include/zencore/zencore.h index 9f8af8c41..023b237cd 100644 --- a/zencore/include/zencore/zencore.h +++ b/zencore/include/zencore/zencore.h @@ -139,23 +139,38 @@ // of std::integral. Some platforms like Ubuntu and Mac OS are still on 12. #if defined(__cpp_lib_concepts) # include <concepts> - template <class T> concept Integral = std::integral<T>; - template <class T> concept SignedIntegral = std::signed_integral<T>; - template <class T> concept UnsignedIntegral = std::unsigned_integral<T>; - template <class F, class... A> concept Invocable = std::invocable<F, A...>; - template <class D, class B> concept DerivedFrom = std::derived_from<D, B>; +template<class T> +concept Integral = std::integral<T>; +template<class T> +concept SignedIntegral = std::signed_integral<T>; +template<class T> +concept UnsignedIntegral = std::unsigned_integral<T>; +template<class F, class... A> +concept Invocable = std::invocable<F, A...>; +template<class D, class B> +concept DerivedFrom = std::derived_from<D, B>; #else - template <class T> concept Integral = std::is_integral_v<T>; - template <class T> concept SignedIntegral = Integral<T> && std::is_signed_v<T>; - template <class T> concept UnsignedIntegral = Integral<T> && !std::is_signed_v<T>; - template <class F, class... A> concept Invocable = requires(F&& f, A&&... a) { std::invoke(std::forward<F>(f), std::forward<A>(a)...); }; - template <class D, class B> concept DerivedFrom = std::is_base_of_v<B, D> && std::is_convertible_v<const volatile D*, const volatile B*>; +template<class T> +concept Integral = std::is_integral_v<T>; +template<class T> +concept SignedIntegral = Integral<T> && std::is_signed_v<T>; +template<class T> +concept UnsignedIntegral = Integral<T> && !std::is_signed_v<T>; +template<class F, class... A> +concept Invocable = requires(F&& f, A&&... a) +{ + std::invoke(std::forward<F>(f), std::forward<A>(a)...); +}; +template<class D, class B> +concept DerivedFrom = std::is_base_of_v<B, D> && std::is_convertible_v<const volatile D*, const volatile B*>; #endif #if defined(__cpp_lib_ranges) - template <typename T> concept ContiguousRange = std::ranges::contiguous_range<T>; +template<typename T> +concept ContiguousRange = std::ranges::contiguous_range<T>; #else - template <typename T> concept ContiguousRange = true; +template<typename T> +concept ContiguousRange = true; #endif ////////////////////////////////////////////////////////////////////////// @@ -224,13 +239,13 @@ static_assert(sizeof(wchar_t) == 2, "wchar_t is expected to be two bytes in size # define ZEN_DEBUG_SECTION ZEN_CODE_SECTION(".zcold") #endif -namespace zen { - -class AssertException : public std::logic_error +namespace zen { -public: - AssertException(const char* Msg) : std::logic_error(Msg) {} -}; + class AssertException : public std::logic_error + { + public: + AssertException(const char* Msg) : std::logic_error(Msg) {} + }; } // namespace zen @@ -315,7 +330,7 @@ ZENCORE_API void zencore_forcelinktests(); #ifndef ZEN_USE_MIMALLOC # if ZEN_ARCH_ARM64 - // The vcpkg mimalloc port doesn't support Arm targets + // The vcpkg mimalloc port doesn't support Arm targets # define ZEN_USE_MIMALLOC 0 # else # define ZEN_USE_MIMALLOC 1 |