#include <ncbimisc.hpp>
Inheritance diagram for AutoPtr< X, Del >:


Define an "auto_ptr" like class that can be used inside STL containers.
The Standard auto_ptr template from STL doesn't allow the auto_ptr to be put in STL containers (list, vector, map etc.). The reason for this is the absence of copy constructor and assignment operator. We decided that it would be useful to have an analog of STL's auto_ptr without this restriction - AutoPtr.
Due to nature of AutoPtr its copy constructor and assignment operator modify the state of the source AutoPtr object as it transfers ownership to the target AutoPtr object. Also, we added possibility to redefine the way pointer will be deleted: the second argument of template allows pointers from "malloc" in AutoPtr, or you can use "ArrayDeleter" (see above) to properly delete an array of objects using "delete[]" instead of "delete". By default, the internal pointer will be deleted by C++ "delete" operator.
Definition at line 430 of file ncbimisc.hpp.
Public Types | |
| typedef X | element_type |
| Define element type. | |
| typedef Del | deleter_type |
| Alias for template argument. | |
Public Member Functions | |
| AutoPtr (element_type *p=0) | |
| Constructor. | |
| AutoPtr (element_type *p, const deleter_type &deleter) | |
| Constructor. | |
| AutoPtr (element_type *p, EOwnership ownership) | |
| Constructor, own the pointed object if ownership == eTakeOwnership. | |
| AutoPtr (element_type *p, const deleter_type &deleter, EOwnership ownership) | |
| Constructor, own the pointed object if ownership == eTakeOwnership. | |
| AutoPtr (const AutoPtr< X, Del > &p) | |
| Copy constructor. | |
| ~AutoPtr (void) | |
| Destructor. | |
| AutoPtr< X, Del > & | operator= (const AutoPtr< X, Del > &p) |
| Assignment operator. | |
| AutoPtr< X, Del > & | operator= (element_type *p) |
| Assignment operator. | |
| operator bool (void) const | |
| element_type & | operator * (void) const |
| Dereference operator. | |
| element_type * | operator-> (void) const |
| Reference operator. | |
| element_type * | get (void) const |
| Get pointer. | |
| element_type * | release (void) |
| Release will release ownership of pointer to caller. | |
| void | reset (element_type *p=0, EOwnership ownership=eTakeOwnership) |
| Reset will delete old pointer, set content to new value, and accept ownership upon the new pointer. | |
| void | Swap (AutoPtr< X, Del > &a) |
Private Member Functions | |
| void | operator< (bool) const |
| Bool operator for use in if() clause. | |
| void | operator> (bool) const |
| void | operator<= (bool) const |
| void | operator>= (bool) const |
| void | operator== (bool) const |
| void | operator!= (bool) const |
| void | operator+ (bool) const |
| void | operator- (bool) const |
| element_type * | x_Release (void) const |
| Release for const object. | |
Private Attributes | |
| element_type * | m_Ptr |
| Internal pointer representation. | |
| pair_base_member< deleter_type, bool > | m_Data |
| State info. | |
|
|||||
|
Alias for template argument.
Definition at line 434 of file ncbimisc.hpp. |
|
|||||
|
Define element type.
Definition at line 433 of file ncbimisc.hpp. |
|
||||||||||
|
Constructor.
Definition at line 437 of file ncbimisc.hpp. |
|
||||||||||||||||
|
Constructor.
Definition at line 443 of file ncbimisc.hpp. |
|
||||||||||||||||
|
Constructor, own the pointed object if ownership == eTakeOwnership.
Definition at line 449 of file ncbimisc.hpp. |
|
||||||||||||||||||||
|
Constructor, own the pointed object if ownership == eTakeOwnership.
Definition at line 455 of file ncbimisc.hpp. |
|
||||||||||
|
Copy constructor.
Definition at line 461 of file ncbimisc.hpp. |
|
||||||||||
|
Destructor.
Definition at line 468 of file ncbimisc.hpp. |
|
||||||||||
|
||||||||||
|
Dereference operator.
Definition at line 497 of file ncbimisc.hpp. |
|
||||||||||
|
Definition at line 492 of file ncbimisc.hpp. |
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
Reference operator.
Definition at line 500 of file ncbimisc.hpp. |
|
||||||||||
|
Bool operator for use in if() clause.
|
|
||||||||||
|
|
|
||||||||||
|
Assignment operator.
Definition at line 485 of file ncbimisc.hpp. |
|
||||||||||
|
Assignment operator.
Definition at line 474 of file ncbimisc.hpp. |
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
|
|
||||||||||
|
||||||||||||||||
|
||||||||||
|
Definition at line 525 of file ncbimisc.hpp. |
|
||||||||||
|
Release for const object.
Definition at line 536 of file ncbimisc.hpp. Referenced by AutoPtr< CNcbiOstrstream >::AutoPtr(), and AutoPtr< CNcbiOstrstream >::operator=(). |
|
|||||
|
State info.
Definition at line 533 of file ncbimisc.hpp. Referenced by AutoPtr< CNcbiOstrstream >::operator=(), AutoPtr< CNcbiOstrstream >::release(), AutoPtr< CNcbiOstrstream >::reset(), AutoArray< CS_INT >::Swap(), and AutoPtr< CNcbiOstrstream >::Swap(). |
|
|||||
|
Internal pointer representation.
Definition at line 532 of file ncbimisc.hpp. Referenced by AutoPtr< CNcbiOstrstream >::AutoPtr(), AutoPtr< CNcbiOstrstream >::get(), AutoPtr< CNcbiOstrstream >::operator *(), AutoPtr< CNcbiOstrstream >::operator->(), AutoPtr< CNcbiOstrstream >::release(), AutoPtr< CNcbiOstrstream >::reset(), AutoArray< CS_INT >::Swap(), and AutoPtr< CNcbiOstrstream >::Swap(). |
1.4.6
Modified on Wed Dec 09 08:18:47 2009 by modify_doxy.py rev. 173732