#include <Puma/Array.h>
Inherited by Puma::PtrStack< CTree > [private]
, Puma::PtrStack< CObjectInfo > [private]
, Puma::PtrStack< Puma::CStructure > [private]
, Puma::Stack< bool > [private]
, Puma::Stack< const char * > [private]
, Puma::Stack< CProtection::Type > [private]
, Puma::Stack< Puma::Syntax::State > [private]
, Puma::Stack< Puma::CTree * > [private]
, Puma::Stack< MemberAccessOperator > [private]
, Puma::Stack< unsigned > [private]
, and Puma::Stack< Item > [private]
.
template<class Item>
class Puma::Array< Item >
Variable length array implementation.
Grows with an increasing increment.
- Template Parameters
-
|
| Array (long is=default_init_size, long incr=default_increment) |
| Constructor.
|
|
| Array (const Array< Item > &array) |
| Copy-constructor.
|
|
Array< Item > & | operator= (const Array< Item > ©) |
| Assignment operator.
|
|
| ~Array () |
| Destructor.
|
|
void | append (const Item &item) |
| Append an item to the array.
|
|
void | insert (long index, const Item &item) |
| Insert an item at the given array index.
|
|
void | prepend (const Item &item) |
| Prepend an item.
|
|
void | remove (long index) |
| Remove the array item at the given array index.
|
|
void | reset () |
| Reset the array.
|
|
Item & | get (long index) |
| Get a reference to the array item at the given array index.
|
|
Item & | operator[] (long index) |
| Get a reference to the array item at the given array index.
|
|
Item | fetch (long index) const |
| Get the array item at the given array index.
|
|
Item & | lookup (long index) const |
| Get a reference to the array item at the given array index.
|
|
long | length () const |
| Get the number of items in the array.
|
|
void | reset () |
|
◆ Array() [1/2]
Constructor.
- Parameters
-
is | The default size of the array. |
incr | The default increment value. |
◆ Array() [2/2]
Copy-constructor.
- Parameters
-
◆ ~Array()
Destructor.
Destroys the array.
◆ append()
Append an item to the array.
- Parameters
-
◆ fetch()
Get the array item at the given array index.
Does not return a reference, thus the item may be implicitely copied.
- Warning
- Does not validate the index!
- Parameters
-
- Returns
- The n-th array item.
◆ get()
Get a reference to the array item at the given array index.
If the index exceeds the array bounds, then the array is reallocated accordingly.
- Parameters
-
- Returns
- A reference to the n-th array item.
◆ insert()
template<class Item >
void Puma::Array< Item >::insert |
( |
long | index, |
|
|
const Item & | item ) |
|
inline |
Insert an item at the given array index.
- Parameters
-
index | The array index. |
item | The item to insert. |
◆ length()
Get the number of items in the array.
- Returns
- The length of the array.
◆ lookup()
Get a reference to the array item at the given array index.
- Warning
- Does not validate the index!
- Parameters
-
- Returns
- A reference to the n-th array item.
◆ operator=()
Assignment operator.
- Parameters
-
◆ operator[]()
Get a reference to the array item at the given array index.
If the index exceeds the array bounds, then the array is reallocated accordingly.
- Parameters
-
- Returns
- A reference to the n-th array item.
◆ prepend()
Prepend an item.
- Parameters
-
◆ remove()
Remove the array item at the given array index.
- Parameters
-
◆ reset() [1/2]
Reset the array.
Destroys the current array.
◆ reset() [2/2]
◆ default_increment
Default array size increment.
◆ default_init_size