Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/scoped-holder-transfer.hpp"
Addendum to scoped-holder.hpp for transferring the lifecycle management to another instance.
Using these wrappers within STL vector and similar containers may result in the need to do a re-allocation in response to a request to grow. Obviously such a feature needs support by the objects being wrapped, which should provide an operation for transferring lifecycle management in a controlled fashion. This behaviour is similar to std::auto_ptr, but because we use a separate dedicated operation, we avoid some of the dangers pertaining the use of the latter: just taking the "value" can't kill the managed object.
transfer_control(TY& from, TY& to)
intended to be found by ADL. Note: in case this function throws, it must not have any side effects.operator bool()
yielding true iff currently containing an managed object. This is similar to std::unique_ptr or even the behaviour of a plain old raw pointer, which is equivalent to true
when the pointer isn'T NULL
Definition at line 68 of file scoped-holder-transfer.hpp.
Public Member Functions | |
Allocator_TransferNoncopyable (const _ThisType &allo) | |
Allocator_TransferNoncopyable (const PAR &allo) | |
template<typename X > | |
Allocator_TransferNoncopyable (const std::allocator< X > &) | |
pointer | address (reference r) const |
const_pointer | address (const_reference cr) const |
pointer | allocate (size_type n, const void *p=0) |
void | construct (pointer p, const TY &ref) |
void | deallocate (pointer p, size_type n) |
void | destroy (pointer p) |
size_type | max_size () const |
Classes | |
struct | rebind |
Private Types | |
typedef Allocator_TransferNoncopyable< TY, PAR > | _ThisType |
Private Attributes | |
PAR | par_ |
struct lib::Allocator_TransferNoncopyable::rebind |
Class Members | ||
---|---|---|
typedef Allocator_TransferNoncopyable < XX, PAR > |
other |