Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_Bilat_Graph2D / INC / model / shared_array.h
1 #ifndef SHAREDARRAY_H_
2 #define SHAREDARRAY_H_
3
4 // C++11
5 #include <memory>
6
7 /*----------------------------------------------------------------------*\
8 |* Declaration *|
9 \*---------------------------------------------------------------------*/
10
11 /*--------------------------------------*\
12 |* Public *|
13 \*-------------------------------------*/
14
15 template<class T>
16 class shared_array: public std::shared_ptr<T>
17 {
18 public:
19 shared_array(T* pointer) :
20 std::shared_ptr<T>(pointer, std::default_delete<T[]>())
21 {
22
23 }
24
25 T& operator[](int i)
26 {
27 return this->get()[i];
28 }
29
30 T& operator[](int i) const
31 {
32 return this->get()[i];
33 }
34 };
35
36 #endif
37
38 /*----------------------------------------------------------------------*\
39 |* End *|
40 \*---------------------------------------------------------------------*/