[v2,23/31] Add a noop deleter

Message ID 20190503231231.8954-24-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey May 3, 2019, 11:12 p.m. UTC
  This adds a no-op deleter, which is used in subsequent patches.

2019-05-01  Tom Tromey  <tom@tromey.com>

	* common/gdb_unique_ptr.h (struct noop_deleter): New.
---
 gdb/ChangeLog               | 4 ++++
 gdb/common/gdb_unique_ptr.h | 7 +++++++
 2 files changed, 11 insertions(+)
  

Patch

diff --git a/gdb/common/gdb_unique_ptr.h b/gdb/common/gdb_unique_ptr.h
index 327e1279296..a4be2bb7963 100644
--- a/gdb/common/gdb_unique_ptr.h
+++ b/gdb/common/gdb_unique_ptr.h
@@ -47,6 +47,13 @@  struct xfree_deleter<T[]>
 template<typename T> using unique_xmalloc_ptr
   = std::unique_ptr<T, xfree_deleter<T>>;
 
+/* A no-op deleter.  */
+template<typename T>
+struct noop_deleter
+{
+  void operator() (T *ptr) const { }
+};
+
 } /* namespace gdb */
 
 #endif /* COMMON_GDB_UNIQUE_PTR_H */