aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPharap <2933055+Pharap@users.noreply.github.com>2018-08-18 09:09:15 +0100
committerGitHub <noreply@github.com>2018-08-18 09:09:15 +0100
commitc6ce36d56cd5e874e60c3ba8a36cc77c307df718 (patch)
tree73562226d18a76936e479f97d9c2385ac5b49e57
parentb7c607663fecc232e598f2c0acf419ceb0b7078c (diff)
Add placement new operator
-rw-r--r--cores/arduino/new.cpp4
-rw-r--r--cores/arduino/new.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/cores/arduino/new.cpp b/cores/arduino/new.cpp
index cf6f89c..bfb219d 100644
--- a/cores/arduino/new.cpp
+++ b/cores/arduino/new.cpp
@@ -26,6 +26,10 @@ void *operator new[](size_t size) {
return malloc(size);
}
+void * operator new(size_t size, void * ptr) {
+ return ptr;
+}
+
void operator delete(void * ptr) {
free(ptr);
}
diff --git a/cores/arduino/new.h b/cores/arduino/new.h
index 6e1b68f..7690911 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);
void operator delete(void * ptr);
void operator delete[](void * ptr);