summaryrefslogtreecommitdiff
path: root/transport/include/hidl/ConcurrentMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'transport/include/hidl/ConcurrentMap.h')
-rw-r--r--transport/include/hidl/ConcurrentMap.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/transport/include/hidl/ConcurrentMap.h b/transport/include/hidl/ConcurrentMap.h
index 1b06dfd..329752c 100644
--- a/transport/include/hidl/ConcurrentMap.h
+++ b/transport/include/hidl/ConcurrentMap.h
@@ -90,6 +90,23 @@ public:
std::map<K, V> mMap;
};
+namespace details {
+
+// TODO(b/69122224): remove this type and usages of it
+// DO NOT ADD USAGES
+template <typename T>
+class DoNotDestruct {
+ public:
+ DoNotDestruct() { new (buffer) T(); }
+ T& get() { return *reinterpret_cast<T*>(buffer); }
+ T* operator->() { return reinterpret_cast<T*>(buffer); }
+
+ private:
+ alignas(T) char buffer[sizeof(T)];
+};
+
+} // namespace details
+
} // namespace hardware
} // namespace android