2 Copyright (C) 2000-2007 MySQL AB
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; see the file COPYING. If not, write to the
15 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20 /* mySTL memory_arry implements auto_array
24 #ifndef mySTL_MEMORY_ARRAY_HPP
25 #define mySTL_MEMORY_ARRAY_HPP
29 // disable operator-> warning for builtins
30 #pragma warning(disable:4284)
38 struct auto_array_ref
{
40 explicit auto_array_ref(T
* p
) : ptr_(p
) {}
51 yaSSL::ysArrayDelete(ptr_
);
53 TaoCrypt::tcArrayDelete(ptr_
);
57 explicit auto_array(T
* p
= 0) : ptr_(p
) {}
65 auto_array(auto_array
& other
) : ptr_(other
.release()) {}
67 auto_array
& operator=(auto_array
& that
)
71 ptr_
= that
.release();
107 // auto_array_ref conversions
108 auto_array(auto_array_ref
<T
> ref
) : ptr_(ref
.ptr_
) {}
110 auto_array
& operator=(auto_array_ref
<T
> ref
)
112 if (this->ptr_
!= ref
.ptr_
) {
119 template<typename T2
>
120 operator auto_array
<T2
>()
122 return auto_array
<T2
>(this->release());
125 template<typename T2
>
126 operator auto_array_ref
<T2
>()
128 return auto_array_ref
<T2
>(this->release());
135 #endif // mySTL_MEMORY_ARRAY_HPP