Skip to content

v0.2.54..v0.2.55 changeset SharedPtrPool.h

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/util/SharedPtrPool.h b/hoot-core/src/main/cpp/hoot/core/util/SharedPtrPool.h
index 5f424e1..8724804 100644
--- a/hoot-core/src/main/cpp/hoot/core/util/SharedPtrPool.h
+++ b/hoot-core/src/main/cpp/hoot/core/util/SharedPtrPool.h
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 #ifndef SHAREDPTRPOOL_H
 #define SHAREDPTRPOOL_H
@@ -59,13 +59,21 @@ public:
       std::bind(&SharedPtrPool<T>::_destroy, this, std::placeholders::_1));
   }
 
-  static SharedPtrPool<T>& getInstance() { return _theInstance; }
+  static SharedPtrPool<T>& getInstance()
+  {
+    static SharedPtrPool<T> instance;
+    return instance;
+  }
 
 private:
 
-  SharedPtrPool() {}
+  /** Default constructor/destructor */
+  SharedPtrPool() = default;
+  ~SharedPtrPool() = default;
+  /** Delete copy constructor and assignment operator */
+  SharedPtrPool(const SharedPtrPool<T>&) = delete;
+  SharedPtrPool<T>& operator=(const SharedPtrPool<T>&) = delete;
 
-  static SharedPtrPool<T> _theInstance;
   boost::fast_pool_allocator<T> _pool;
 
   void _destroy(T* v)
Clone this wiki locally