1
/*****************************************************************************
4
Copyright (c) 2005 Laurent de Soras
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
*Tab=3***********************************************************************/
26
#if defined (DynArray_CURRENT_CODEHEADER)
27
#error Recursive inclusion of DynArray code header.
29
#define DynArray_CURRENT_CODEHEADER
31
#if ! defined (DynArray_CODEHEADER_INCLUDED)
32
#define DynArray_CODEHEADER_INCLUDED
36
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
42
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
47
DynArray <T>::DynArray ()
57
DynArray <T>::DynArray (long size)
64
_data_ptr = new DataType [size];
72
DynArray <T>::~DynArray ()
82
long DynArray <T>::size () const
90
void DynArray <T>::resize (long size)
95
DataType * old_data_ptr = _data_ptr;
96
DataType * tmp_data_ptr = new DataType [size];
98
_data_ptr = tmp_data_ptr;
101
delete [] old_data_ptr;
108
const typename DynArray <T>::DataType & DynArray <T>::operator [] (long pos) const
113
return (_data_ptr [pos]);
119
typename DynArray <T>::DataType & DynArray <T>::operator [] (long pos)
124
return (_data_ptr [pos]);
129
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
133
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
137
#endif // DynArray_CODEHEADER_INCLUDED
139
#undef DynArray_CURRENT_CODEHEADER
143
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/