You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-24 15:26:15 +00:00
Merge pull request #51656 from AndreaCatania/paged-allocator-initializer
The `PagedAllocator` can now allocate objects with non empty constructors.
This commit is contained in:
@@ -50,7 +50,8 @@ class PagedAllocator {
|
|||||||
SpinLock spin_lock;
|
SpinLock spin_lock;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
T *alloc() {
|
template <class... Args>
|
||||||
|
T *alloc(const Args &&...p_args) {
|
||||||
if (thread_safe) {
|
if (thread_safe) {
|
||||||
spin_lock.lock();
|
spin_lock.lock();
|
||||||
}
|
}
|
||||||
@@ -75,7 +76,7 @@ public:
|
|||||||
if (thread_safe) {
|
if (thread_safe) {
|
||||||
spin_lock.unlock();
|
spin_lock.unlock();
|
||||||
}
|
}
|
||||||
memnew_placement(alloc, T);
|
memnew_placement(alloc, T(p_args...));
|
||||||
return alloc;
|
return alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user