# Vectors Requires BOOST Vectors offers four template classes. The StaticVector and the DynamicVector, are subclasses of std::tr1::array and std::vector respectively, and extend those types with arithmetic operators. They are meant as an alternative for std::valarray, that, for example, does not have iterators. The definitions are:
    template <typename T, unsigned DIMS>
    class StaticVector;
and
    template <typename T>
    class DynamicVector;
are the most common. There are similar Vectors whose values are kept in sorted order:
    template <typename T, unsigned DIMS>
    class StaticSortedVector
    template <typename T>
    class DynamicSortedVector
These Vectors can be mixed in most operations. There is a special case, StaticVector<bool> that, much like std::vector<bool> in the STL, behaves somewhat differently. ## Interface ### Common Interface of Vectors There are two Vector types, StaticVector and DynamicVector. Their interfaces are almost identical. In the following table, substitute "Vector" with either one.
      value_type
| The type of the values in the vector.
      iterator
| The iterator type of this Vector
      const_iterator
| The const_iterator type of this Vector, for read-only access.
      Vector()
| Default Constructor
      Vector(Iterator first, Iterator last)
| Constructor, copies input from range (first, ..., last).
      template <typename U>
      Vector(const U &data)
| Copy-constructor, generalized to work with any container type or data type.
      iterator begin()
| As in any container.
      iterator end()
| As in any container.
      const_iterator begin()
| As in any container.
      const_iterator end()
| As in any container.
      void clear()
| Set all elements to zero.
      const Vector &operator=(const value_type value)
| Assign a value to every element of the Vector.
      template <typename Container>
      const Vector &operator=(const Container &data)
| Assignment operator, works with any container type.
      value_type &operator[] (unsigned index)
| Access one element.
      const Vector &
      operator{+ - * / %}=(const value_type that)
| Standard operator{+ - * / %}, element-wise applied with 'value'.
      template <typename Container>
      const Vector &
      operator{+ - * / %}=(const Container &that)
| Standard operator{+ - * / %}, applied with another container.
      unsigned size() const
| The number of dimensions
      std::string to_string() const
| Returns a string-representation.
### Specific Interface of StaticVector
      StaticVector(const value_type value)
| Construct a StaticVector and set all elements to 'value'.
      template <typename U>
      StaticVector<U, DIMS> convert() const
| Convert to another type.
### Specific Interface of DynamicVector
      DynamicVector(const unsigned DIMS)
| Construct a DynamicVector with DIMS dimensions.
      DynamicVector(const unsigned DIMS, const T value)
| Construct a DynamicVector with DIMS dimension and set all elements to 'value'.
      void resize(const unsigned DIMS)
| Change the number of dimensions.
### Specific Interface of StaticVector<bool> Note that StaticVector<bool> does not support operator{+, -, *, /, %}.
      value_type
| Alias for type 'bool'
      register_type
| The type used to hold raw data internally.
      iterator
| Iterator for raw data.
      const_iterator
| Read-only iterator for raw data.
      StaticVector()
| Default Constructor
      template <typename Iterator>
      StaticVector(Iterator first, Iterator last)
| Constructs a StaticVector<bool>, fill it with either booleans (if the input range are of type "bool"), or with raw data (if the input range is of type "register_type").
      StaticVector(const std::string &hex)
| Constructs a StaticVector<bool> from a string in lower-case hexadecimal representation.
      iterator begin()
| An iterator to raw data of type "register_type".
      iterator end()
| An iterator to raw data of type "register_type".
      const_iterator begin()
| An iterator to raw data of type "register_type".
      const_iterator end()
| An iterator to raw data of type "register_type".
      void clear()
| Set all bit to zero.
      template <typename Iterator>
    		void set(Iterator first, Iterator last)
| Fill with either booleans (if the input range are of type "bool"), or with raw data (if the input range is of type "register_type").
      void setElement(unsigned index, bool value)
| Set a bit to the given value.
      const StaticVector operator~() const
| Flip all bits.
      void flip()
| Flip all bits.
      void flip(const unsigned index)
| Flip bit at "index".
      unsigned count() const
| Return the number of bits set to 1.
      bool odd() const
| Returns true if an uneven number of bits set to 1.
      bool even() const
| Returns true if an even number of bits set to 1.
      const StaticVector &operator|=(const StaticVector &that)
| Apply element-by-element OR.
      const StaticVector &operator|=(const bool value)
| Apply OR to each element.
      const StaticVector &operator^=(const StaticVector &that)
| Apply element-by-element XOR.
      const StaticVector &operator^=(const bool value)
| Apply XOR to each element.
      const StaticVector &operator&=(const StaticVector &that)
| >Apply element-by-element AND.
      const StaticVector &operator&=(const bool value)
| Apply AND to each element.
      unsigned size()
| Returns the number of dimensions of the vector.
      std::string to_string()
| Returns a lower-case hexadecimal representation.
### Common Interface of SortedVectors There are two types of vectors that keep their contents in sorted order, so-called "SortedVectors". In the following table, read either "StaticSortedVector" or "DynamicSortedVector" for "SortedVector".
      value_type
| The type of the elements in the SortedVector.
      const_iterator
| A read-only iterator.
      SortedVector(const_iterator first, const_iterator last)
| Constructor that fill the SortedVector with values from the range "first" to "last".
      const_iterator begin() const
| Returns a const_iterator to the first element.
      const_iterator end() const
| Returns a const_iterator indicating the end of the SortedVector.
      const value_type operator[] (unsigned index) const
      void set(const_iterator first, const_iterator last)
| Fill the SortedVector with values from the range "first" to "last".
      bool has(const value_type value) const
| Returns true if any element in the SortedVector is "value".
      unsigned size()
| Returns the number of dimensions of the SortedVector.
      const std::string to_string() const
| Returns a string-representation of the SortedVector.
### Operators and Fuctions
      template <typename T, class TOther>
      Vector<T,...> crossProduct(const Vector<T, ...> &lhs, const TOther &rhs)
| Cross-product of vectors of 3 dimensions.
      template <typename T, class TOther>
      Vector<T,...> dotProduct(const Vector<T,...> &lhs, const TOther &rhs)
| Dot-product of vectors.
## See Also Euclid