Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_Bilat_Graph2D / INC / model / shared_array.h
diff --git a/WCudaMSE/API_Bilat_Graph2D/INC/model/shared_array.h b/WCudaMSE/API_Bilat_Graph2D/INC/model/shared_array.h
new file mode 100755 (executable)
index 0000000..a7fa2fe
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef SHAREDARRAY_H_
+#define SHAREDARRAY_H_
+
+// C++11
+#include <memory>
+
+/*----------------------------------------------------------------------*\
+ |*                    Declaration                                     *|
+ \*---------------------------------------------------------------------*/
+
+/*--------------------------------------*\
+ |*            Public                  *|
+ \*-------------------------------------*/
+
+template<class T>
+class shared_array: public std::shared_ptr<T>
+    {
+    public:
+       shared_array(T* pointer) :
+               std::shared_ptr<T>(pointer, std::default_delete<T[]>())
+           {
+
+           }
+
+       T& operator[](int i)
+           {
+           return this->get()[i];
+           }
+
+       T& operator[](int i) const
+           {
+           return this->get()[i];
+           }
+    };
+
+#endif 
+
+/*----------------------------------------------------------------------*\
+ |*                    End                                             *|
+ \*---------------------------------------------------------------------*/