A class containing an owned object. More...
#include <ProviderList.h>
Classes | |
struct | share_t |
Public Member Functions | |
MovableClassWrapper () | |
Default constructor: no datum present (move one in later on) More... | |
template<typename U > | |
MovableClassWrapper (std::unique_ptr< U > &&from) | |
template<typename U > | |
MovableClassWrapper (MovableClassWrapper< U > const &from, share_t) | |
Share constructor (kind of copy) More... | |
datum_t & | ref () |
Returns a reference to the datum with the correct type. More... | |
datum_t const & | ref () const |
Returns a constant reference to the datum with the correct type. More... | |
datum_t * | get () |
Returns a pointer to the datum with the correct type. More... | |
datum_t const * | get () const |
Returns a constant pointer to the datum with the correct type. More... | |
MovableClassWrapper () | |
Default constructor: no datum present (move one in later on) More... | |
template<typename U > | |
MovableClassWrapper (std::unique_ptr< U > &&from) | |
template<typename U > | |
MovableClassWrapper (MovableClassWrapper< U > const &from, share_t) | |
Share constructor (kind of copy) More... | |
datum_t & | ref () |
Returns a reference to the datum with the correct type. More... | |
datum_t const & | ref () const |
Returns a constant reference to the datum with the correct type. More... | |
datum_t * | get () |
Returns a pointer to the datum with the correct type. More... | |
datum_t const * | get () const |
Returns a constant pointer to the datum with the correct type. More... | |
MovableClassWrapper (pointer_t &&from) | |
Constructor and assignment from a unique pointer: steal the content. More... | |
MovableClassWrapper & | operator= (pointer_t &&from) |
bool | valid () const |
Returns whether there is a valid pointer. More... | |
operator bool () const | |
MovableClassWrapper (pointer_t &&from) | |
Constructor and assignment from a unique pointer: steal the content. More... | |
MovableClassWrapper & | operator= (pointer_t &&from) |
bool | valid () const |
Returns whether there is a valid pointer. More... | |
operator bool () const | |
Public Member Functions inherited from testing::details::MovableClassWrapperBase | |
virtual | ~MovableClassWrapperBase ()=default |
virtual | ~MovableClassWrapperBase ()=default |
Static Public Attributes | |
static constexpr share_t | share = {} |
type to specify a share constructor More... | |
Private Types | |
using | datum_t = T |
contained type More... | |
using | this_t = MovableClassWrapper< T > |
this type More... | |
using | pointer_t = std::shared_ptr< datum_t > |
pointer storing datum More... | |
using | datum_t = T |
contained type More... | |
using | this_t = MovableClassWrapper< T > |
this type More... | |
using | pointer_t = std::shared_ptr< datum_t > |
pointer storing datum More... | |
Private Attributes | |
pointer_t | ptr |
Friends | |
template<typename U > | |
class | MovableClassWrapper |
A class containing an owned object.
T | type of the contained object |
Differently from boost::any, T
does not have to be copiable nor movable. The price is that the object is dynamically allocated.
Given that we don't require T to be movable and we don't require it to be polymorphic, we need some way to move T and have T recognized as such when put in a mixed container. Hence this wrapper. The price is quite high: two chained dynamic allocations per object (one in the wrapper to provide mobility, the other in the container not to lose polymorphism).
T | type of the contained object |
Differently from std::any, T
does not have to be copiable nor movable. The price is that the object is dynamically allocated.
Given that we don't require T to be movable and we don't require it to be polymorphic, we need some way to move T and have T recognized as such when put in a mixed container. Hence this wrapper. The price is quite high: two chained dynamic allocations per object (one in the wrapper to provide mobility, the other in the container not to lose polymorphism).
Definition at line 58 of file ProviderList.h.
|
private |
contained type
Definition at line 59 of file ProviderList.h.
|
private |
contained type
Definition at line 59 of file ProviderList.h.
|
private |
pointer storing datum
Definition at line 61 of file ProviderList.h.
|
private |
pointer storing datum
Definition at line 61 of file ProviderList.h.
|
private |
this type
Definition at line 60 of file ProviderList.h.
|
private |
this type
Definition at line 60 of file ProviderList.h.
|
inline |
Default constructor: no datum present (move one in later on)
Definition at line 73 of file ProviderList.h.
|
inline |
Definition at line 76 of file ProviderList.h.
|
inline |
Constructor and assignment from a unique pointer: steal the content.
Definition at line 80 of file ProviderList.h.
|
inline |
|
inline |
Default constructor: no datum present (move one in later on)
Definition at line 73 of file ProviderList.h.
|
inline |
Definition at line 76 of file ProviderList.h.
|
inline |
Constructor and assignment from a unique pointer: steal the content.
Definition at line 80 of file ProviderList.h.
|
inline |
|
inline |
|
inline |
|
inline |
Returns a constant pointer to the datum with the correct type.
Definition at line 101 of file ProviderList.h.
|
inline |
Returns a constant pointer to the datum with the correct type.
Definition at line 101 of file ProviderList.h.
|
inline |
Definition at line 107 of file ProviderList.h.
|
inline |
Definition at line 107 of file ProviderList.h.
|
inline |
Definition at line 81 of file ProviderList.h.
|
inline |
Definition at line 81 of file ProviderList.h.
|
inline |
Returns a reference to the datum with the correct type.
Definition at line 92 of file ProviderList.h.
|
inline |
Returns a reference to the datum with the correct type.
Definition at line 92 of file ProviderList.h.
|
inline |
Returns a constant reference to the datum with the correct type.
Definition at line 95 of file ProviderList.h.
|
inline |
Returns a constant reference to the datum with the correct type.
Definition at line 95 of file ProviderList.h.
|
inline |
|
inline |
Definition at line 65 of file ProviderList.h.
|
private |
Definition at line 111 of file ProviderList.h.
|
static |
type to specify a share constructor
Definition at line 70 of file ProviderList.h.