template<class T>
class IndirectionList< T >
IndirectionList is a domain representing a N dimension set of integer sequences.
It is always a 1D list, but can store data of multiple dimensions (if, say, the type T is Loc<Dim>)
IndirectionList can be constructed using any of the Array class objects (Array, DynamicArray) . The constructor accepts only one such object. It is a templated constructor, however, and can work with any object that has an Array-like interface.
The default IndirectionList constructor initializes the IndirectionList to be empty, that is, to have a length() of zero. In that case, the endpoints are undefined, as is any operation involving the IndirectionList.
In addition to the constructors, IndirectionList has the following public interface, similar to all 1D domain objects.
IndirectionList<T> interface:
- long size() - return the 'volume' of the domain, which is the product of the lengths of the N 1D IndirectionLists
- bool empty() - return if any of the IndirectionList objects have length == 0
- IndirectionList operator[](int N) - return the Nth IndirectionList in a multidimensional IndirectionList<M>. For IndirectionList objects, this just returns the object back.
- comparison operators: <, >, !=, ==, <=, >= : compare a IndirectionList to another domain object. The compared domains must have the same number of dimensions.
- arithmetic accumulation operators +=, -=, *=, /= : add or subtract in a given domain. The added domain must have the same number of dimensions, or a dimension of 1 (in which case, the same value is used for all dimensions), and be known to be single-valued (which is true for Loc and int's). Note that for IndirectionList, *= and /= ARE allowed *= and /= result in scaling of each element in the IndirectionList which leaves the length (and size) the same. += and -= shift the beginning endpoints by the given values, also leaving the length and size the same. Negation of a IndirectionList negates the elements. Be aware that negation of an IndirecitonList will result in an object that is malformed for the DynamicArray.destroy() operators.
- binary arithmethic operators +, -, *, / : for + and -, adding a IndirectionList to another Loc or int returns a new IndirectionList. For * and /, scaling by a Loc or int also returns a IndirectionList object
- increment/decrement operator ++, -- : only prefix versions of ++ and -- are provided; they act just like += 1 and -= 1 operations.
- int length() - number of elements (including endpoints) of the domain.
- long size() - same as above.
- int first() - the beginning endpoint.
- int last() - the ending endpoint.
- int min(), int max() - min or max of the endpoints.
- IndirectionList::iterator begin() and end() - return iterators for the 1D domain. These act like (at least) forward iterators.