BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlar::ArrayRef Class Reference

#include <bdlar_arrayref.h>

Public Member Functions

template<class t_ARRAY >
 ArrayRef (t_ARRAY &array, typename bsl::enable_if< IsArray< t_ARRAY >::value >::type *=0)
 
 ArrayRef (void *objectAddress, const ArrayVtable *vtable)
 
template<class t_MANIPULATOR >
int manipulateElement (t_MANIPULATOR &manipulator, int index) const
 
void reset () const
 
void resize (int newSize) const
 
template<class t_ACCESSOR >
int accessElement (t_ACCESSOR &accessor, int index) const
 
bdlat_TypeCategory::Value elementCategory () const
 
const ArrayVtablevtable () const
 
void * objectAddress () const
 
bsl::size_t size () const
 

Constructor & Destructor Documentation

◆ ArrayRef() [1/2]

template<class t_ARRAY >
bdlar::ArrayRef::ArrayRef ( t_ARRAY &  array,
typename bsl::enable_if< IsArray< t_ARRAY >::value >::type *  = 0 
)
inlineexplicit

Create ArrayRef object that type erases the supplied array object.

◆ ArrayRef() [2/2]

bdlar::ArrayRef::ArrayRef ( void *  objectAddress,
const ArrayVtable vtable 
)
inline

Create ArrayRef object.

Precondition
The behaviour is undefined unless objectAddress and vtable point to the valid objects.

Member Function Documentation

◆ accessElement()

template<class t_ACCESSOR >
int bdlar::ArrayRef::accessElement ( t_ACCESSOR &  accessor,
int  index 
) const
inline

Invoke the specified accessor on the array element at the specified index. The supplied accessor must be a callable type that can be called as if it had the following signature:

int accessor(const ELEMENT& refOrValue);

Return the value from the invocation of accessor.

Precondition
The behavior is undefined unless 0 <= index < size().

◆ elementCategory()

bdlat_TypeCategory::Value bdlar::ArrayRef::elementCategory ( ) const
inline

Return the element type category of the wrapped array.

◆ manipulateElement()

template<class t_MANIPULATOR >
int bdlar::ArrayRef::manipulateElement ( t_MANIPULATOR &  manipulator,
int  index 
) const
inline

Invoke the specified manipulator on the array element at the specified index. The supplied manipulator must be a callable type that can be called as if it had the following signature:

int manipulator(ELEMENT *refOrValue);

Return the value from the invocation of manipulator.

Precondition
The behavior is undefined unless 0 <= index < size().

◆ objectAddress()

void * bdlar::ArrayRef::objectAddress ( ) const
inline

Return a pointer to the wrapped array.

◆ reset()

void bdlar::ArrayRef::reset ( ) const
inline

Reset the referred object to the default value.

◆ resize()

void bdlar::ArrayRef::resize ( int  newSize) const
inline

Set the size to the specified newSize. If newSize > size(), then newSize - size() elements with default values are appended to the array. If newSize < size(), then the size() - newSize elements at the end of the array are destroyed.

Precondition
The behavior is undefined unless 0 <= newSize.

◆ size()

bsl::size_t bdlar::ArrayRef::size ( ) const
inline

Return the number of elements in the wrapped array.

◆ vtable()

const ArrayVtable * bdlar::ArrayRef::vtable ( ) const
inline

Return a pointer to the vtable.


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