 Range and Slice Storage
Range and Slice StorageThe class range specifies a range of indicies. The range is a sequence of indices
from a start value to stop value. The indices increase by one and exlude the stop value.
range can therefore be used to specify ranges of elements from vectors and matrices.
#include <boost/numeric/ublas/storage.hpp>
int main () {
    using namespace boost::numeric::ublas;
    range r (0, 3);
    for (unsigned i = 0; i < r.size (); ++ i) {
        std::cout << r (i) << std::endl;
    }
}
Defined in the header storage.hpp.
Reversible Container.
None, except for those imposed by the requirements of Reversible Container.
None.
| Member | Description | 
|---|---|
| range (size_type start, size_type stop) | Constructs a range of indicies from starttostop (excluded). | 
| size_type start () const | Returns the beginning of the range. | 
| size_type size () const | Returns the size of the range. | 
| const_reference operator [] (size_type i)
const | Returns the value start + iof thei-th element. | 
| range compose (const range &r) const | Returns the composite range from start + r.start
()tostart + r.start () + r.size (). | 
| bool operator == (const range &r) const | Tests two ranges for equality. | 
| bool operator != (const range &r) const | Tests two ranges for inequality. | 
| const_iterator begin () const | Returns a const_iteratorpointing to the beginning
of therange. | 
| const_iterator end () const | Returns a const_iteratorpointing to the end of
therange. | 
| const_reverse_iterator rbegin () const | Returns a const_reverse_iteratorpointing to the
beginning of the reversedrange. | 
| const_reverse_iterator rend () const | Returns a const_reverse_iteratorpointing to the
end of the reversedrange. | 
start () <= stop ()The class slice specifies a 'slice' of indicies. Slices are more general
then ranges, the stride allows the sequence of indicies to increase and decrease by the specified amount between element.
slice can therefore be used to specify slices of element from vectors and matrices.
#include <boost/numeric/ublas/storage.hpp>
int main () {
    using namespace boost::numeric::ublas;
    slice s (0, 1, 3);
    for (unsigned i = 0; i < s.size (); ++ i) {
        std::cout << s (i) << std::endl;
    }
}
Defined in the header storage.hpp.
Reversible Container.
None, except for those imposed by the requirements of Reversible Container.
None.
| Member | Description | 
|---|---|
| slice (size_type start, size_type stride, size_type
size) | Constructs a slice start,start+stride,start+2*stride...withsizeelements. | 
| size_type start () const | Returns the beginning of the slice. | 
| size_type stride () const | Returns the stride of the slice. | 
| size_type size () const | Returns the size of the slice. | 
| const_reference operator [] (size_type i)
const | Returns the value start + i * strideof thei-th element. | 
| slice compose (const range &r) const | Returns the composite slice from start + stride * r.start
()tostart + stride * (r.start () + r.size ())with stridestride. | 
| slice compose (const slice &s) const | Returns the composite slice from start + stride * s.start
()tostart + stride * s.stride () * (s.start () +
s.size ())with stridestride * s.stride (). | 
| bool operator == (const slice &s) const | Tests two slices for equality. | 
| bool operator != (const slice &s) const | Tests two slices for inequality. | 
| const_iterator begin () const | Returns a const_iteratorpointing to the beginning
of theslice. | 
| const_iterator end () const | Returns a const_iteratorpointing to the end of
theslice. | 
| const_reverse_iterator rbegin () const | Returns a const_reverse_iteratorpointing to the
beginning of the reversedslice. | 
| const_reverse_iterator rend () const | Returns a const_reverse_iteratorpointing to the
end of the reversedslice. | 
      Copyright (©) 2000-2004 Michael Stevens, Mathias Koch,
      Joerg Walter, Gunter Winkler
      Use, modification and distribution are subject to the
      Boost Software License, Version 1.0.
      (See accompanying file LICENSE_1_0.txt
      or copy at 
         http://www.boost.org/LICENSE_1_0.txt
      ).