FastJet
3.3.3
|
an implementation of C++0x shared pointers (or boost's) More...
#include <fastjet/SharedPtr.hh>
Public Member Functions | |
SharedPtr () | |
default ctor | |
template<class Y > | |
SharedPtr (Y *ptr) | |
initialise with the main data More... | |
SharedPtr (SharedPtr const &share) | |
overload the copy ctor so that it updates count More... | |
~SharedPtr () | |
default dtor | |
void | reset () |
reset the pointer to default value (NULL) | |
template<class Y > | |
void | reset (Y *ptr) |
reset from a pointer | |
template<class Y > | |
void | reset (SharedPtr< Y > const &share) |
do a smart copy More... | |
SharedPtr & | operator= (SharedPtr const &share) |
overload the = operator so that it updates count More... | |
template<class Y > | |
SharedPtr & | operator= (SharedPtr< Y > const &share) |
overload the = operator so that it updates count More... | |
T * | operator() () const |
return the pointer we're pointing to More... | |
T & | operator* () const |
indirection, get a reference to the stored pointer More... | |
T * | operator-> () const |
indirection, get the stored pointer More... | |
T * | get () const |
get the stored pointer | |
bool | unique () const |
check if the instance is unique | |
long | use_count () const |
return the number of counts | |
operator bool () const | |
conversion to bool This will allow you to use the indirection nicely | |
void | swap (SharedPtr &share) |
exchange the content of the two pointers | |
void | set_count (const long &count) |
force the count to be set to a specified value More... | |
an implementation of C++0x shared pointers (or boost's)
this class implements a smart pointer, based on the shared+ptr proposal. A description of shared_ptr can be found in Section 2.2.3 of the first C++ Technical Report (TR1) http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1745.pdf or, alternatively, on the Boost C++ library website at http://www.boost.org/doc/libs/1_42_0/libs/smart_ptr/shared_ptr.htm
Our implementation is compatible with both of these apart from a series of members and functions that have not been implemented:
We also add the possibility to force an update of the count.
The class has been tested against the existing boost (v1.42) implementation (for the parts that we have implemented).
Definition at line 121 of file SharedPtr.hh.
initialise with the main data
t | : the object we want a smart pointer to |
Definition at line 131 of file SharedPtr.hh.
|
inline |
overload the copy ctor so that it updates count
share | : the object we want to copy |
Definition at line 137 of file SharedPtr.hh.
|
inline |
do a smart copy
share | : the object we want to copy Q? Do we need a non-template<Y> version as for the ctor and the assignment? |
Definition at line 182 of file SharedPtr.hh.
|
inline |
overload the = operator so that it updates count
share | : the object we want to copy |
Definition at line 206 of file SharedPtr.hh.
|
inline |
overload the = operator so that it updates count
share | : the object we want to copy |
Definition at line 213 of file SharedPtr.hh.
|
inline |
return the pointer we're pointing to
Since FastJet 3.2.0, this is depracated since it is no longer part of std::shared_ptr<T>. Use SharedPtr<T>::get() instead
Definition at line 223 of file SharedPtr.hh.
|
inline |
indirection, get a reference to the stored pointer
!!! WATCH OUT It fails to check the requirement that the stored pointer must not be NULL!! So you need explicitly to check the validity in your code
Definition at line 234 of file SharedPtr.hh.
|
inline |
indirection, get the stored pointer
!!! WATCH OUT It fails to check the requirement that the stored pointer must not be NULL!! So you need explicitly to check the validity in your code
Definition at line 244 of file SharedPtr.hh.
|
inline |
force the count to be set to a specified value
count | the value that we need to reset to |
Definition at line 284 of file SharedPtr.hh.