cloudy
trunk
|
#include <cddefines.h>
Data Structures | |
struct | auto_vec_ref |
Public Types | |
typedef T | element_type |
Public Member Functions | |
auto_vec (element_type *p=NULL) throw () | |
auto_vec (auto_vec &p) throw () | |
auto_vec & | operator= (auto_vec &p) throw () |
~auto_vec () throw () | |
element_type & | operator[] (ptrdiff_t n) const throw () |
element_type * | get () const throw () |
element_type * | data () const throw () |
element_type * | release () throw () |
void | reset (element_type *p=NULL) throw () |
auto_vec (auto_vec_ref< element_type > r) throw () | |
auto_vec & | operator= (auto_vec_ref< element_type > r) throw () |
operator auto_vec_ref< element_type > () throw () | |
Private Attributes | |
T * | ptr |
auto_vec: a smart pointer to allocated arrays which maintains strict ownership. the implementation here largely follows the ISO/ANSI C++98 standard for auto_ptr
NB1 - the operator[] and data() methods were added and are not part of the standard
NB2 - operator* and operator-> have been omitted as they are not useful for vectors
NB3 - the class has been altered to disallow assigning pointers of a different type, i.e., auto_vec<BaseClass> p( new DerivedClass[10] ) is NOT allowed. This is done because BaseClass and DerivedClass often have different sizes, and hence using them like this in vectors is error-prone.
NB4 - operator auto_vec<T>() has been omitted because it is only needed to convert an auto_vec<DerivedClass> to auto_vec<BaseClass>.
This is written in the standards draft (with auto_ptr replaced by auto_vec):
1 Template auto_vec holds a pointer to an array object obtained via new and deletes that object when it itself is destroyed (such as when leaving block scope 6.7).
2 Template auto_vec_ref holds a reference to an auto_vec. It is used by the auto_vec conversions to allow auto_vec objects to be passed to and returned from functions.
Definition at line 1156 of file cddefines.h.
typedef T auto_vec< T >::element_type |
Definition at line 1172 of file cddefines.h.
|
inlineexplicit |
Definition at line 1176 of file cddefines.h.
Definition at line 1180 of file cddefines.h.
Definition at line 1189 of file cddefines.h.
|
inline |
Definition at line 1226 of file cddefines.h.
|
inline |
Definition at line 1205 of file cddefines.h.
Referenced by newelement(), and newspecies().
|
inline |
Definition at line 1200 of file cddefines.h.
|
inline |
Definition at line 1239 of file cddefines.h.
Definition at line 1184 of file cddefines.h.
|
inline |
Definition at line 1230 of file cddefines.h.
References auto_vec< T >::ptr.
|
inline |
Definition at line 1196 of file cddefines.h.
|
inline |
Definition at line 1209 of file cddefines.h.
|
inline |
Definition at line 1215 of file cddefines.h.
|
private |
Definition at line 1158 of file cddefines.h.
Referenced by auto_vec< T >::operator=().