c++20 fixes

v1
Brett 2024-02-04 14:24:25 -05:00
parent b2534baaf0
commit 2f400a6240
4 changed files with 20 additions and 8 deletions

View File

@ -16,10 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#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

View File

@ -24,6 +24,7 @@
#include <utility>
#include <vector>
#include <string_view>
#include <string>
namespace blt::gfx
{

View File

@ -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<class U>
struct rebind
{
typedef std::allocator<U> other;
typedef blt::area_allocator<U, BLOCK_SIZE> 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;
}
}

View File

@ -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;
}