diff options
author | 2015-09-17 15:53:10 +0000 | |
---|---|---|
committer | 2015-09-17 15:53:10 +0000 | |
commit | ca83cd09bde09dac73ed66f38dec4bc0bd6afb54 (patch) | |
tree | a4d1a7267ae3009758b704d8aa0dd30133baea08 /runtime/base/macros.h | |
parent | e3b223594e2e9d91903a62180c9660664052506b (diff) | |
parent | 76c92ac73eeda2582caee39dd427ca035caf172b (diff) |
Merge "Optimizing: Allow storing value objects in containers."
Diffstat (limited to 'runtime/base/macros.h')
-rw-r--r-- | runtime/base/macros.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/base/macros.h b/runtime/base/macros.h index 1d5dee23f8..dc692d2b75 100644 --- a/runtime/base/macros.h +++ b/runtime/base/macros.h @@ -68,9 +68,12 @@ template<typename T> ART_FRIEND_TEST(test_set_name, individual_test) DISALLOW_COPY_AND_ASSIGN(TypeName) // A macro to disallow new and delete operators for a class. It goes in the private: declarations. +// NOTE: Providing placement new (and matching delete) for constructing container elements. #define DISALLOW_ALLOCATION() \ public: \ NO_RETURN ALWAYS_INLINE void operator delete(void*, size_t) { UNREACHABLE(); } \ + ALWAYS_INLINE void* operator new(size_t, void* ptr) noexcept { return ptr; } \ + ALWAYS_INLINE void operator delete(void*, void*) noexcept { } \ private: \ void* operator new(size_t) = delete |