CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <cloneable_ptr.hh>
A 'cloneable_ptr' can be used in place of 'unique_ptr'.
If you are creating a class 'MyNewClass' that will have 'std::unique_ptr<Type> m_data' as a class member, you have to explicitly write a copy constructor.
If Type has method 'virtual std::unique_ptr<Type> clone() const' you can use 'notstd::cloneable_ptr<Type> m_data' in place of 'std::unique_ptr<Type> m_data' as a class member and not have to explicity write copy constructors.
Definition at line 163 of file cloneable_ptr.hh.
Public Types | |
typedef Type | element_type |
typedef Type * | pointer |
typedef Type & | reference |
Public Member Functions | |
cloneable_ptr () | |
Default constructor. More... | |
cloneable_ptr (pointer ptr) | |
Construct by taking ownership of ptr. More... | |
cloneable_ptr (const cloneable_ptr &other) | |
Construct by cloning other. More... | |
template<typename U > | |
cloneable_ptr (const cloneable_ptr< U > &other) | |
Construct by cloning other. More... | |
cloneable_ptr (cloneable_ptr &&other) | |
Construct by moving other. More... | |
template<typename U > | |
cloneable_ptr (cloneable_ptr< U > &&other) | |
Construct by moving other. More... | |
template<typename U > | |
cloneable_ptr (const std::unique_ptr< U > &other) | |
Construct by cloning other. More... | |
template<typename U > | |
cloneable_ptr (std::unique_ptr< U > &&other) | |
Construct by moving. More... | |
~cloneable_ptr () | |
cloneable_ptr & | operator= (cloneable_ptr other) |
Assignment via copy-swap. More... | |
template<typename U > | |
cloneable_ptr & | operator= (cloneable_ptr< U > &&other) |
Assignment via move. More... | |
template<typename U > | |
cloneable_ptr & | operator= (const std::unique_ptr< U > &other) |
Assignment via clone. More... | |
template<typename U > | |
cloneable_ptr & | operator= (std::unique_ptr< U > &&other) |
Assignment via move. More... | |
reference | operator* () const |
pointer | operator-> () const |
void | reset () |
Reset contained unique_ptr. More... | |
std::unique_ptr< Type > & | unique () |
Access contained unique_ptr. More... | |
const std::unique_ptr< Type > & | unique () const |
const Access contained unique_ptr More... | |
operator bool () const | |
Checks whether *this owns an object. More... | |
template<typename U > | |
cloneable_ptr< Type > & | operator= (cloneable_ptr< U > &&other) |
Assignment via move. More... | |
template<typename U > | |
cloneable_ptr< Type > & | operator= (const std::unique_ptr< U > &other) |
Assignment via clone. More... | |
template<typename U > | |
cloneable_ptr< Type > & | operator= (std::unique_ptr< U > &&other) |
Assignment via move. More... | |
Private Attributes | |
std::unique_ptr< Type > | m_unique |
typedef Type notstd::cloneable_ptr< Type >::element_type |
Definition at line 165 of file cloneable_ptr.hh.
typedef Type* notstd::cloneable_ptr< Type >::pointer |
Definition at line 166 of file cloneable_ptr.hh.
typedef Type& notstd::cloneable_ptr< Type >::reference |
Definition at line 167 of file cloneable_ptr.hh.
|
inline |
Default constructor.
Definition at line 170 of file cloneable_ptr.hh.
|
explicit |
Construct by taking ownership of ptr.
Definition at line 295 of file cloneable_ptr.hh.
notstd::cloneable_ptr< Type >::cloneable_ptr | ( | const cloneable_ptr< Type > & | other | ) |
Construct by cloning other.
Definition at line 299 of file cloneable_ptr.hh.
notstd::cloneable_ptr< Type >::cloneable_ptr | ( | const cloneable_ptr< U > & | other | ) |
Construct by cloning other.
Definition at line 308 of file cloneable_ptr.hh.
notstd::cloneable_ptr< Type >::cloneable_ptr | ( | cloneable_ptr< Type > && | other | ) |
Construct by moving other.
Definition at line 316 of file cloneable_ptr.hh.
notstd::cloneable_ptr< Type >::cloneable_ptr | ( | cloneable_ptr< U > && | other | ) |
Construct by moving other.
Definition at line 322 of file cloneable_ptr.hh.
notstd::cloneable_ptr< Type >::cloneable_ptr | ( | const std::unique_ptr< U > & | other | ) |
Construct by cloning other.
Definition at line 328 of file cloneable_ptr.hh.
notstd::cloneable_ptr< Type >::cloneable_ptr | ( | std::unique_ptr< U > && | other | ) |
Construct by moving.
Definition at line 338 of file cloneable_ptr.hh.
notstd::cloneable_ptr< Type >::~cloneable_ptr |
Definition at line 342 of file cloneable_ptr.hh.
|
explicit |
Checks whether *this owns an object.
Definition at line 411 of file cloneable_ptr.hh.
cloneable_ptr< Type >::reference notstd::cloneable_ptr< Type >::operator* |
Definition at line 382 of file cloneable_ptr.hh.
cloneable_ptr< Type >::pointer notstd::cloneable_ptr< Type >::operator-> |
Definition at line 387 of file cloneable_ptr.hh.
cloneable_ptr< Type > & notstd::cloneable_ptr< Type >::operator= | ( | cloneable_ptr< Type > | other | ) |
Assignment via copy-swap.
Definition at line 346 of file cloneable_ptr.hh.
cloneable_ptr& notstd::cloneable_ptr< Type >::operator= | ( | cloneable_ptr< U > && | other | ) |
Assignment via move.
cloneable_ptr<Type>& notstd::cloneable_ptr< Type >::operator= | ( | cloneable_ptr< U > && | other | ) |
Assignment via move.
Definition at line 354 of file cloneable_ptr.hh.
cloneable_ptr& notstd::cloneable_ptr< Type >::operator= | ( | const std::unique_ptr< U > & | other | ) |
Assignment via clone.
cloneable_ptr<Type>& notstd::cloneable_ptr< Type >::operator= | ( | const std::unique_ptr< U > & | other | ) |
Assignment via clone.
Definition at line 362 of file cloneable_ptr.hh.
cloneable_ptr& notstd::cloneable_ptr< Type >::operator= | ( | std::unique_ptr< U > && | other | ) |
Assignment via move.
cloneable_ptr<Type>& notstd::cloneable_ptr< Type >::operator= | ( | std::unique_ptr< U > && | other | ) |
Assignment via move.
Definition at line 375 of file cloneable_ptr.hh.
void notstd::cloneable_ptr< Type >::reset |
Reset contained unique_ptr.
Definition at line 393 of file cloneable_ptr.hh.
std::unique_ptr< Type > & notstd::cloneable_ptr< Type >::unique |
Access contained unique_ptr.
Definition at line 399 of file cloneable_ptr.hh.
const std::unique_ptr< Type > & notstd::cloneable_ptr< Type >::unique |
const Access contained unique_ptr
Definition at line 405 of file cloneable_ptr.hh.
|
private |
Definition at line 231 of file cloneable_ptr.hh.