Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Toggle main menu visibility
Loading...
Searching...
No Matches
Allocator.hh
1
#pragma once
2
3
#include "egg/core/Heap.hh"
4
5
namespace
Kinoko::EGG
{
6
7
template
<
typename
T>
8
struct
Allocator {
9
using
value_type = T;
10
11
Allocator() =
default
;
12
template
<
typename
U>
13
constexpr
Allocator(
const
Allocator<U> &)
noexcept
{}
14
15
[[nodiscard]] T *allocate(
size_t
n) {
16
return
static_cast<
T *
>
(egg_alloc(n *
sizeof
(T),
static_cast<
s32
>
(
alignof
(T))));
17
}
18
19
void
deallocate(T *ptr,
size_t
)
noexcept
{
20
egg_free(ptr);
21
}
22
};
23
24
template
<
typename
T,
typename
U>
25
constexpr
bool
operator==(
const
Allocator<T>
&,
const
Allocator<U>
&)
noexcept
{
26
return
true
;
27
}
28
29
}
// namespace Kinoko::EGG
Kinoko::EGG
EGG core library.
Definition
Allocator.hh:5
Kinoko::EGG::Allocator
Definition
Allocator.hh:8
egg
core
Allocator.hh
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.17.0