ACE 8.0.5
Loading...
Searching...
No Matches
ACE_Array< T > Class Template Reference

A dynamic array class. More...

#include <Containers_T.h>

Inheritance diagram for ACE_Array< T >:
Collaboration diagram for ACE_Array< T >:

Public Types

typedef T TYPE
typedef ACE_Array_Iterator< T > ITERATOR
Public Types inherited from ACE_Array_Base< T >
typedef T TYPE
typedef ACE_Array_Iterator< T > ITERATOR
typedef T value_type
typedef value_typeiterator
typedef value_type constconst_iterator
typedef value_typereference
typedef value_type constconst_reference
typedef value_typepointer
typedef value_type constconst_pointer
typedef ptrdiff_t difference_type
typedef ACE_Allocator::size_type size_type
typedef std::reverse_iterator< iteratorreverse_iterator
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator

Public Member Functions

 ACE_Array (size_t size=0, ACE_Allocator *alloc=0)
 Dynamically create an uninitialized array.
 ACE_Array (size_t size, const T &default_value, ACE_Allocator *alloc=0)
 Dynamically initialize the entire array to the {default_value}.
 ACE_Array (const ACE_Array< T > &s)
 Copy constructor.
void operator= (const ACE_Array< T > &s)
 Assignment operator.
bool operator== (const ACE_Array< T > &s) const
 Equality comparison operator.
bool operator!= (const ACE_Array< T > &s) const
 Inequality comparison operator.
Public Member Functions inherited from ACE_Array_Base< T >
 ACE_Array_Base (size_type size=0, ACE_Allocator *the_allocator=0)
 Dynamically create an uninitialized array.
 ACE_Array_Base (size_type size, T const &default_value, ACE_Allocator *the_allocator=0)
 Dynamically initialize the entire array to the default_value.
 ACE_Array_Base (ACE_Array_Base< T > const &s)
void operator= (ACE_Array_Base< T > const &s)
 ~ACE_Array_Base ()
 Clean up the array (e.g., delete dynamically allocated memory).
T & operator[] (size_type slot)
T constoperator[] (size_type slot) const
int set (T const &new_item, size_type slot)
int get (T &item, size_type slot) const
size_type size () const
 Returns the <cur_size_> of the array.
int size (size_type new_size)
size_type max_size () const
 Returns the <max_size_> of the array.
int max_size (size_type new_size)
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
reverse_iterator rbegin ()
reverse_iterator rend ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
void swap (ACE_Array_Base< T > &array)

Additional Inherited Members

bool in_range (size_type slot) const
size_type max_size_
size_type cur_size_
value_typearray_
 Pointer to the array's storage buffer.
ACE_Allocatorallocator_
 Allocation strategy of the ACE_Array_Base.

Detailed Description

template<class T>
class ACE_Array< T >

A dynamic array class.

This class extends ACE_Array_Base, adding comparison operators.

Requirements and Performance Characteristics

  • Internal Structure Dynamic array
  • Duplicates allowed? Yes
  • Random access allowed? Yes
  • Search speed N/A
  • Insert/replace speed O(1)
  • Iterator still valid after change to container?
    • In general, yes.
    • If array size is changed during iteration, no.
  • Frees memory for removed elements? No
  • Items inserted by Value
  • Requirements for contained type
    1. Default constructor
    2. Copy constructor
    3. operator=
    4. operator!=
See also
ACE_Array_Base. This class inherits its operations and requirements.

Member Typedef Documentation

◆ ITERATOR

template<class T>
typedef ACE_Array_Iterator<T> ACE_Array< T >::ITERATOR

◆ TYPE

template<class T>
typedef T ACE_Array< T >::TYPE

Constructor & Destructor Documentation

◆ ACE_Array() [1/3]

template<class T>
ACE_Array< T >::ACE_Array ( size_t size = 0,
ACE_Allocator * alloc = 0 )
inline

Dynamically create an uninitialized array.

Initialize an empty array of the specified size using the provided allocation strategy.

◆ ACE_Array() [2/3]

template<class T>
ACE_Array< T >::ACE_Array ( size_t size,
const T & default_value,
ACE_Allocator * alloc = 0 )
inline

Dynamically initialize the entire array to the {default_value}.

Initialize an array the given size placing the default_value in each index.

◆ ACE_Array() [3/3]

template<class T>
ACE_Array< T >::ACE_Array ( const ACE_Array< T > & s)
inline

Copy constructor.

The copy constructor performs initialization by making an exact copy of the contents of parameter {s}, i.e., *this == s will return true.

Member Function Documentation

◆ operator!=()

template<class T>
bool ACE_Array< T >::operator!= ( const ACE_Array< T > & s) const
inline

Inequality comparison operator.

Compare this array with {s} for inequality such that {*this} != {s} is always the complement of the boolean return value of {*this} == {s}.

◆ operator=()

template<class T>
void ACE_Array< T >::operator= ( const ACE_Array< T > & s)
inline

Assignment operator.

Assignment operator performs an assignment by making an exact copy of the contents of parameter {s}, i.e., *this == s will return true. Note that if the {max_size_} of {array_} is >= than {s.max_size_} we can copy it without reallocating. However, if {max_size_} is < {s.max_size_} we must delete the {array_}, reallocate a new {array_}, and then copy the contents of {s}.

◆ operator==()

template<class T>
bool ACE_Array< T >::operator== ( const ACE_Array< T > & s) const

Equality comparison operator.

Compare this array with {s} for equality. Two arrays are equal if their {size}'s are equal and all the elements from 0 .. {size} are equal.


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