Quick Links:

bal | bbl | bdl | bsl

Public Member Functions

bsls::ObjectBuffer< TYPE > Union Template Reference

#include <bsls_objectbuffer.h>

List of all members.

Public Member Functions

TYPE * address ()
char * buffer ()
TYPE & object ()
const TYPE * address () const
const char * buffer () const
const TYPE & object () const

Detailed Description

template<class TYPE>
union bsls::ObjectBuffer< TYPE >

An instance of this union is a raw block of memory suitable for storing an object of type TYPE. Specifically, the size and alignment of this union exactly matches that of TYPE. A TYPE object can be constructed into an ObjectBuffer using the placement new operator and can be destroyed by explicitly calling its destructor, ~TYPE(). It is the user's responsibility to perform this construction and destruction; an ObjectBuffer object does not manage the construction or destruction of any other objects.

Note that a collaboration is implied between ObjectBuffer and the user. An ObjectBuffer provides aligned memory and the user handles construction and destruction of the object contained within that memory.

See Component bsls_objectbuffer


Member Function Documentation

template<class TYPE>
TYPE* bsls::ObjectBuffer< TYPE >::address (  ) 

Return the address of the first byte of this object, cast to a TYPE * pointer.

Referenced by bslalg::NothrowMovableWrapper< TYPE >::NothrowMovableWrapper().

template<class TYPE>
char* bsls::ObjectBuffer< TYPE >::buffer (  ) 

Return the address of the first byte of this object, cast to a char * pointer.

template<class TYPE>
TYPE& bsls::ObjectBuffer< TYPE >::object (  ) 

Return a modifiable reference to the TYPE object occupying this buffer. The referenced object has undefined state unless a valid TYPE object has been constructed in this buffer.

Referenced by bslalg::NothrowMovableWrapper< TYPE >::get_allocator(), bslalg::NothrowMovableWrapper< TYPE >::unwrap(), and bslalg::NothrowMovableWrapper< TYPE >::~NothrowMovableWrapper().

template<class TYPE>
const TYPE* bsls::ObjectBuffer< TYPE >::address (  )  const

Return the address of the first byte of this object, cast to a const TYPE * pointer.

template<class TYPE>
const char* bsls::ObjectBuffer< TYPE >::buffer (  )  const

Return the address of the first byte of this object, cast to a const char * pointer.

template<class TYPE>
const TYPE& bsls::ObjectBuffer< TYPE >::object (  )  const

Return a const reference to the TYPE object occupying this buffer. The referenced object has undefined state unless a valid TYPE object has been constructed in this buffer.


The documentation for this union was generated from the following file: