summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-08-14 14:12:47 +0200
committerGitHub <noreply@github.com>2021-08-14 14:12:47 +0200
commit087ec7b8add8cc60de0bc9974b58ff625daa8cc2 (patch)
tree68a2a3f7139e44a51632e6f06f48e3201163c230 /core
parentb9b6102b916a679429acfd5a56b1acf353a11b0e (diff)
parentc81cb64416217df2de4032c818914fea0691e92c (diff)
Merge pull request #51656 from AndreaCatania/paged-allocator-initializer
The `PagedAllocator` can now allocate objects with non empty constructors.
Diffstat (limited to 'core')
-rw-r--r--core/templates/paged_allocator.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/templates/paged_allocator.h b/core/templates/paged_allocator.h
index 481289309f..dfc885c6eb 100644
--- a/core/templates/paged_allocator.h
+++ b/core/templates/paged_allocator.h
@@ -50,7 +50,8 @@ class PagedAllocator {
SpinLock spin_lock;
public:
- T *alloc() {
+ template <class... Args>
+ T *alloc(const Args &&...p_args) {
if (thread_safe) {
spin_lock.lock();
}
@@ -75,7 +76,7 @@ public:
if (thread_safe) {
spin_lock.unlock();
}
- memnew_placement(alloc, T);
+ memnew_placement(alloc, T(p_args...));
return alloc;
}