BDE 4.39.x Production Release
Loading...
Searching...
No Matches

Classes

struct  ElementType
 
struct  ElementType< bdlar::ArrayConstRef >
 
struct  ElementType< bdlar::ArrayRef >
 
struct  ElementType< bsl::vector< TYPE, ALLOC > >
 
struct  ElementType< s_baltst::TestDynamicType< VALUE_TYPE > >
 
struct  ElementType< s_baltst::TestTaggedValue< TAG_TYPE, VALUE_TYPE > >
 
struct  IsArray
 
struct  IsArray< bdlar::ArrayConstRef >
 
struct  IsArray< bdlar::ArrayRef >
 
struct  IsArray< bsl::vector< TYPE, ALLOC > >
 
struct  IsArray< s_baltst::TestDynamicType< VALUE_TYPE > >
 
struct  IsArray< s_baltst::TestTaggedValue< TAG_TYPE, VALUE_TYPE > >
 

Functions

template<class TYPE , class MANIPULATOR >
int manipulateElement (TYPE *array, MANIPULATOR &manipulator, int index)
 
template<class TYPE >
int reserve (TYPE *array, int numElements)
 
template<class TYPE >
void resize (TYPE *array, int newSize)
 
template<class TYPE , class ACCESSOR >
int accessElement (const TYPE &array, ACCESSOR &accessor, int index)
 
template<class TYPE >
bsl::size_t size (const TYPE &array)
 
template<class TYPE >
bool supportsReserve (const TYPE &array)
 
template<class TYPE >
int bdlat_arrayReserve (TYPE *array, int numElements)
 
template<class TYPE >
bool bdlat_arraySupportsReserve (const TYPE &array)
 
template<class TYPE , class ALLOC , class MANIPULATOR >
int bdlat_arrayManipulateElement (bsl::vector< TYPE, ALLOC > *array, MANIPULATOR &manipulator, int index)
 
template<class TYPE , class ALLOC >
int bdlat_arrayReserve (bsl::vector< TYPE, ALLOC > *array, int numElements)
 
template<class TYPE , class ALLOC >
void bdlat_arrayResize (bsl::vector< TYPE, ALLOC > *array, int newSize)
 
template<class TYPE , class ALLOC , class ACCESSOR >
int bdlat_arrayAccessElement (const bsl::vector< TYPE, ALLOC > &array, ACCESSOR &accessor, int index)
 
template<class TYPE , class ALLOC >
bsl::size_t bdlat_arraySize (const bsl::vector< TYPE, ALLOC > &array)
 
template<class TYPE , class ALLOC >
bool bdlat_arraySupportsReserve (const bsl::vector< TYPE, ALLOC > &array)
 

Detailed Description

This namespace provides functions that expose "array" behavior for "array" types. Specializations are provided for bsl::vector<TYPE>. See the component-level documentation for more information.

This namespace declaration adds the default implementations for reserve capacity methods.

This namespace declaration adds the implementation of the "array" traits for bsl::vector to bdlat_ArrayFunctions.

Note
Note that bsl::vector is the canonical "array" type.

Function Documentation

◆ accessElement()

template<class TYPE , class ACCESSOR >
int bdlat_ArrayFunctions::accessElement ( const TYPE &  array,
ACCESSOR &  accessor,
int  index 
)

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

int accessor(const ELEMENT_TYPE& element);

Return the value from the invocation of accessor.

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

◆ bdlat_arrayAccessElement()

template<class TYPE , class ALLOC , class ACCESSOR >
int bdlat_ArrayFunctions::bdlat_arrayAccessElement ( const bsl::vector< TYPE, ALLOC > &  array,
ACCESSOR &  accessor,
int  index 
)

◆ bdlat_arrayManipulateElement()

template<class TYPE , class ALLOC , class MANIPULATOR >
int bdlat_ArrayFunctions::bdlat_arrayManipulateElement ( bsl::vector< TYPE, ALLOC > *  array,
MANIPULATOR &  manipulator,
int  index 
)

◆ bdlat_arrayReserve() [1/2]

template<class TYPE , class ALLOC >
int bdlat_ArrayFunctions::bdlat_arrayReserve ( bsl::vector< TYPE, ALLOC > *  array,
int  numElements 
)

◆ bdlat_arrayReserve() [2/2]

template<class TYPE >
int bdlat_ArrayFunctions::bdlat_arrayReserve ( TYPE *  array,
int  numElements 
)

◆ bdlat_arrayResize()

template<class TYPE , class ALLOC >
void bdlat_ArrayFunctions::bdlat_arrayResize ( bsl::vector< TYPE, ALLOC > *  array,
int  newSize 
)

◆ bdlat_arraySize()

template<class TYPE , class ALLOC >
bsl::size_t bdlat_ArrayFunctions::bdlat_arraySize ( const bsl::vector< TYPE, ALLOC > &  array)

◆ bdlat_arraySupportsReserve() [1/2]

template<class TYPE , class ALLOC >
bool bdlat_ArrayFunctions::bdlat_arraySupportsReserve ( const bsl::vector< TYPE, ALLOC > &  array)

◆ bdlat_arraySupportsReserve() [2/2]

template<class TYPE >
bool bdlat_ArrayFunctions::bdlat_arraySupportsReserve ( const TYPE &  array)

◆ manipulateElement()

template<class TYPE , class MANIPULATOR >
int bdlat_ArrayFunctions::manipulateElement ( TYPE *  array,
MANIPULATOR &  manipulator,
int  index 
)

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

// int manipulator(ELEMENT_TYPE *element);

Return the value from the invocation of manipulator.

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

◆ reserve()

template<class TYPE >
int bdlat_ArrayFunctions::reserve ( TYPE *  array,
int  numElements 
)

If successful, make the capacity of the specified modifiable array at least the specified numElements and return zero. If unsuccessful or unsupported, return a non-zero value. This method has no effect, and returns zero, if the current capacity meets or exceeds the required capacity.

Precondition
The behavior is undefined unless 0 <= numElements.

◆ resize()

template<class TYPE >
void bdlat_ArrayFunctions::resize ( TYPE *  array,
int  newSize 
)

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

Precondition
The behavior is undefined unless 0 <= newSize.

◆ size()

template<class TYPE >
bsl::size_t bdlat_ArrayFunctions::size ( const TYPE &  array)

Return the number of elements in the specified array.

◆ supportsReserve()

template<class TYPE >
bool bdlat_ArrayFunctions::supportsReserve ( const TYPE &  array)

Return true if reserve will attempt to reserve capacity in the specified array, and false otherwise.