Skip to content

Commit

Permalink
aligned.h: Another try at fixing the GCC 13 compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengtuggy committed Nov 25, 2023
1 parent 049dc5e commit 353b8b8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions engine/src/gfx/aligned.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@

#define _ALIGNED(x) alignas(x)

template<typename T, typename U>
using Rebind = typename std::allocator_traits<T>::template rebind_alloc<U>;

template<typename T, typename = T>
struct HasRebind {
using value_type = T;
template<typename U> struct rebind { using other = HasRebind<U>; };
};

template<typename T, int ALIGN = 16>
class aligned_allocator : public std::allocator<T> {
public:
Expand All @@ -59,8 +68,12 @@ class aligned_allocator : public std::allocator<T> {

static const int _OVERHEAD = (sizeof(T) + ALIGN - 1) / ALIGN + sizeof(size_t);

aligned_allocator() {
}
aligned_allocator() = default;

template<typename U> struct rebind {
using value_type = T;
using other = aligned_allocator<U>;
};

template<typename A>
explicit aligned_allocator(const A &other) : std::allocator<T>(other) {
Expand Down

0 comments on commit 353b8b8

Please sign in to comment.