aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Entinger <consulting@lxrobotics.com>2019-09-16 10:17:41 +0200
committerGitHub <noreply@github.com>2019-09-16 10:17:41 +0200
commit742abcd9660d4b754fede51f098113fca918cb54 (patch)
tree45b841b2c84f84f0ccdb0f8aed96462b3a232f8d
parentffe7ae05d25f647adb7afa3596d13bf7522158ca (diff)
parent6a717473175cc7d900fe67bc071f7e7c72f01e29 (diff)
Merge pull request #33 from Pharap/add-placement-new
Add placement new operator
-rw-r--r--cores/arduino/new.cpp5
-rw-r--r--cores/arduino/new.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/cores/arduino/new.cpp b/cores/arduino/new.cpp
index cf6f89c..fc30cf8 100644
--- a/cores/arduino/new.cpp
+++ b/cores/arduino/new.cpp
@@ -26,6 +26,11 @@ void *operator new[](size_t size) {
return malloc(size);
}
+void * operator new(size_t size, void * ptr) noexcept {
+ (void)size;
+ return ptr;
+}
+
void operator delete(void * ptr) {
free(ptr);
}
diff --git a/cores/arduino/new.h b/cores/arduino/new.h
index 6e1b68f..763f5cc 100644
--- a/cores/arduino/new.h
+++ b/cores/arduino/new.h
@@ -23,6 +23,7 @@
void * operator new(size_t size);
void * operator new[](size_t size);
+void * operator new(size_t size, void * ptr) noexcept;
void operator delete(void * ptr);
void operator delete[](void * ptr);