From ae41066fbe7493bc1aaac7c06590ff196d218106 Mon Sep 17 00:00:00 2001 From: Mateusz Loskot Date: Wed, 14 Feb 2018 01:10:02 +0100 Subject: [PATCH] Prefer logical punctuators instead of named operator keywords Some compilers (eg. MSVC) still require inclusion of in order to import named operator keywords. It is easier to stick with traditional punctuators. --- include/engine/base64.hpp | 4 ++-- include/storage/io.hpp | 4 ++-- include/util/guidance/entry_class.hpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/engine/base64.hpp b/include/engine/base64.hpp index 2cb7d3b50..024d04b29 100644 --- a/include/engine/base64.hpp +++ b/include/engine/base64.hpp @@ -87,7 +87,7 @@ inline std::string encodeBase64(const std::string &x) { return encodeBase64(x.da // Encode any sufficiently trivial object to Base64. template std::string encodeBase64Bytewise(const T &x) { -#if not defined __GNUC__ or __GNUC__ > 4 +#if !defined(__GNUC__) || (__GNUC__ > 4) static_assert(std::is_trivially_copyable::value, "requires a trivially copyable type"); #endif @@ -124,7 +124,7 @@ inline std::string decodeBase64(const std::string &encoded) // Decodes from Base 64 to any sufficiently trivial object. template T decodeBase64Bytewise(const std::string &encoded) { -#if not defined __GNUC__ or __GNUC__ > 4 +#if !defined(__GNUC__) || (__GNUC__ > 4) static_assert(std::is_trivially_copyable::value, "requires a trivially copyable type"); #endif diff --git a/include/storage/io.hpp b/include/storage/io.hpp index 182cd8f38..eefb99a74 100644 --- a/include/storage/io.hpp +++ b/include/storage/io.hpp @@ -96,7 +96,7 @@ class FileReader /* Read count objects of type T into pointer dest */ template void ReadInto(T *dest, const std::size_t count) { -#if not defined __GNUC__ or __GNUC__ > 4 +#if !defined(__GNUC__) || (__GNUC__ > 4) static_assert(!std::is_pointer::value, "saving pointer types is not allowed"); static_assert(std::is_trivially_copyable::value, "bytewise reading requires trivially copyable type"); @@ -214,7 +214,7 @@ class FileWriter /* Write count objects of type T from pointer src to output stream */ template void WriteFrom(const T *src, const std::size_t count) { -#if not defined __GNUC__ or __GNUC__ > 4 +#if !defined(__GNUC__) || (__GNUC__ > 4) static_assert(std::is_trivially_copyable::value, "bytewise writing requires trivially copyable type"); #endif diff --git a/include/util/guidance/entry_class.hpp b/include/util/guidance/entry_class.hpp index e85e2a345..458303644 100644 --- a/include/util/guidance/entry_class.hpp +++ b/include/util/guidance/entry_class.hpp @@ -64,7 +64,7 @@ class EntryClass friend std::size_t std::hash::operator()(const EntryClass &) const; }; -#if not defined __GNUC__ or __GNUC__ > 4 +#if !defined(__GNUC__) || (__GNUC__ > 4) static_assert(std::is_trivially_copyable::value, "Class is serialized trivially in " "the datafacades. Bytewise writing "