Array class
Prerequisits
#include <Array.h>
using namespace polymake ;
Introduction
template <typename ElementType> class Array;
Offers practically the same as std::vector.
The only significant differences are that the data array is attached via a smart pointer with
reference counting , and the set of operations changing the
size of the array is reduced to the minimum.
Array();
Create an empty array.
explicit Array(int n);
Create an array with n elements, initialized with the default constructor.
explicit Array(int n, const ElementType&);
Create an array with n elements, initialized with the same value.
template <typename Iterator>
Array(int n, Iterator src);
Create an array with n elements, initialized from a data sequence.
template <int n>
explicit Array(const ElementType (&a)[n]);
template <typename OtherElementType, int n>
explicit Array(const OtherElementType (&a)[n]);
Create an array with n elements, initialized from a built-in array.
The second variant supposes an explicit element conversion.
Array::operator= (const ElementType (&a)[n]);
Resize to n elements, assign values from the built-in array.
void std::swap(Array&, Array&);
Swap the contents of two arrays in a most efficient way.
template <typename Iterator>
Array::assign (int n, Iterator src);
Resize to n elements, assign values from the data sequence.
template <typename Iterator>
Array::append (int n, Iterator src);
Keep the old elements, add n new elements to the tail, assign them values from the data sequence.
void Array::resize(int n);
If n is less than the current array length, delete the trailing elements. If greater, add new elements
initialized with the default constructor.
Unlike std::vector, Array never allocates extra stock storage. Each resize operation
causes the data area reallocation.
void Array::fill (const ElementType& x);
Assign x to all elements.
Array inplements the
Random Access Container interface.
The element random access method (operator[]) performs index range check if activated via
debugging compilation mode .
std::ostream& operator<< (std::ostream&, const Array&);
If std::ostream::width() is not 0 before the operator is called, each element
is printed in a width-wide field.
std::istream& operator>> (std::istream&, Array&);
Read the space-separated data items from the input stream and assign them to the elements.
The current array length is not changed.
Poly& operator>> (
Poly &, Array&);
Read a property from the polymake server. Set the array length to the number of elements read.
Parse errors are reported by raising the std::iostream::failure exception in the constructor,
or via std::iostream::fail() flag in the input operator.