- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Utils::Containers::VectorImpl Class Reference

`#include <Vector.h>`

Inheritance diagram for Mers::Utils::Containers::VectorImpl:

[legend]
List of all members.

## Public Member Functions
| VectorImpl ()
| Basic constructor.
| VectorImpl (size_type count)
| Creates an empty vector with reserved space for <count> elements.
| VectorImpl (VectorImpl const &other)
| Creates a deep copy of objects in this vector.
virtual | ~VectorImpl ()
| Destructor. Deletes this vector and the objects in it.
reference | operator[] (size_type index)
| Boundary-checking indexing operator.
const Mers::Utils::Lang::Object * | operator[] (size_type index) const
| Boundary-checking indexing operator.
reference | front ()
| Reference to the first element (checked in case that the vector is empty).
const Mers::Utils::Lang::Object * | front () const
| The first element (checked in case that the vector is empty).
reference | back ()
| Reference to the last element (checked in case that the vector is empty).
const Mers::Utils::Lang::Object * | back () const
| The last element (checked in case that the vector is empty).
void | resize (int newSize)
Mers::Utils::Lang::Object * | pop_back ()
| Removes & deletes the last element (checked in case the vector is empty).
void | clear ()
| Clear and delete the contained objects.
void | insert (size_type index, const_reference data)
void | insert (size_type index, const_iterator first, const_iterator last)
void | erase (size_type index)
void | erase (size_type first, size_type last)
virtual void | print (std::ostream &out, char const *seperator) const

## Detailed Description

Implementation of the Vector template. Defines methods, in which Vector differs from the STL vector and which are common to all template vectors:

- deep copy
- printing
- allocating and deleting the elements
- checked access The iterators are provided in Vector template, in order to provide type safety.

Author:
  Stanislav Funiak

  Paul H. Elliott

Definition at line 45 of file Vector.h.

## Member Function Documentation

void VectorImpl::resize | ( | int | newSize | ) |

Increases or reduces the number of elements. If reducing the number of elements, delete the erased objects.

Definition at line 44 of file Vector.cpp.

References erase().

Referenced by clear(), and Mers::Utils::Containers::Vector< T * >::resize().

Here is the call graph for this function:

void VectorImpl::insert | ( | size_type | index,
|  | const_reference | data |
| ) |  |  |

Inserts the element at the specified index. Checks that index is a valid index in the vector.

Definition at line 63 of file Vector.cpp.

Referenced by VectorImpl().

void Mers::Utils::Containers::VectorImpl::insert | ( | size_type | index,
|  | const_iterator | first,
|  | const_iterator | last |
| ) |  |  |

Inserts a copy of the elements [first;last) at the pos. given by <index>. Checks that index is a valid index in the vector.

void VectorImpl::erase | ( | size_type | index | ) |

Removes and deletes the element at the specified index. Checks that index is a valid index in the vector.

Definition at line 94 of file Vector.cpp.

Referenced by resize().

void Mers::Utils::Containers::VectorImpl::erase | ( | size_type | first,
|  | size_type | last |
| ) |  |  |

Removes and deletes the elements in the sequence [first,last) iterator comes from the definition of the STL vector Checks that [first;last) is a valid range in the vector.

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

- /Users/fpy/titan-1-5-MBARI/Mers/Utils/Containers/Vector.h
- /Users/fpy/titan-1-5-MBARI/Mers/Utils/Containers/Vector.cpp