From 2f400a62403f961b7fb20b476ee133b33d682ad6 Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 4 Feb 2024 14:24:25 -0500 Subject: [PATCH] c++20 fixes --- include/blt/compatibility.h | 18 ++++++++++++++---- include/blt/parse/obj_loader.h | 1 + include/blt/std/allocator.h | 5 +++-- include/blt/std/utility.h | 4 ++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/include/blt/compatibility.h b/include/blt/compatibility.h index fe5a97b..b10d4f6 100644 --- a/include/blt/compatibility.h +++ b/include/blt/compatibility.h @@ -16,10 +16,20 @@ * along with this program. If not, see . */ -#ifndef INSANE_DNS_COMPATIBILITY_H -#define INSANE_DNS_COMPATIBILITY_H +#ifndef BLT_COMPATIBILITY_H +#define BLT_COMPATIBILITY_H -#if __cplusplus >= 202002L +#define BLT_CPP23 202302L +#define BLT_CPP20 202002L +#define BLT_CPP17 201703L +#define BLT_CPP14 201402L +#define BLT_CPP11 201103L + +#if __cplusplus >= BLT_CPP23 + +#endif + +#if __cplusplus >= BLT_CPP20 #define BLT_CONTAINS(container, value) container.contains(value) #define BLT_CPP20_CONSTEXPR constexpr #define BLT_USE_CPP20 @@ -41,4 +51,4 @@ #error Filesystem ops not supported!\ #endif -#endif //INSANE_DNS_COMPATIBILITY_H +#endif //BLT_COMPATIBILITY_H diff --git a/include/blt/parse/obj_loader.h b/include/blt/parse/obj_loader.h index 5d2c72d..c86e1bc 100644 --- a/include/blt/parse/obj_loader.h +++ b/include/blt/parse/obj_loader.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace blt::gfx { diff --git a/include/blt/std/allocator.h b/include/blt/std/allocator.h index 4a2d517..53eb2cc 100644 --- a/include/blt/std/allocator.h +++ b/include/blt/std/allocator.h @@ -30,6 +30,7 @@ namespace blt class area_allocator { public: + using value = T; using type = T; using value_type = type; using pointer = type*; @@ -44,7 +45,7 @@ namespace blt template struct rebind { - typedef std::allocator other; + typedef blt::area_allocator other; }; private: /** @@ -218,7 +219,7 @@ namespace blt { if (p >= blk->data && p <= (blk->data + BLOCK_SIZE)) { - blk->unallocated_blocks.push_back({p, n}); + blk->unallocated_blocks.push_back(pointer_view{p, n}); break; } } diff --git a/include/blt/std/utility.h b/include/blt/std/utility.h index e8f8363..4e9f951 100644 --- a/include/blt/std/utility.h +++ b/include/blt/std/utility.h @@ -30,7 +30,7 @@ namespace blt { - static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str) + static inline std::string demangle(const std::string& str) { int status; // only defined for GNU C++11? @@ -45,7 +45,7 @@ namespace blt #else namespace blt { - static BLT_CPP20_CONSTEXPR inline std::string demangle(const std::string& str) + static inline std::string demangle(const std::string& str) { return str; }