Merge pull request #51656 from AndreaCatania/paged-allocator-initializer
The `PagedAllocator` can now allocate objects with non empty constructors.
This commit is contained in:
commit
087ec7b8ad
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue