2
0
mirror of https://github.com/boostorg/ublas.git synced 2026-02-13 00:42:14 +00:00
Files
ublas/doc/storage.htm
Jörg Walter bbca4f92fa A couple of fixes and improvements
svn path=/trunk/boost/boost/numeric/ublas/; revision=18551
2003-05-26 20:55:45 +00:00

962 lines
25 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Storage</title>
</head>
<body bgcolor="#ffffff">
<h1><img src="c++boost.gif" alt="c++boost.gif" align="Center">
Storage</h1>
<h2><a name="unbounded_array"></a> Unbounded Array</h2>
<h4>Description</h4>
<p>The templated class <code>unbounded_array&lt;T&gt;</code>
implements a simple C-like array using allocation via
<code>new/delete</code>.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;<br>
<br>
int main () {<br>
using namespace boost::numeric::ublas;<br>
unbounded_array&lt;double&gt; a (3);<br>
for (unsigned i = 0; i &lt; a.size (); ++ i) {<br>
a [i] = i;<br>
std::cout &lt;&lt; a [i] &lt;&lt; std::endl;<br>
}<br>
}
</pre>
<h4>Definition</h4>
<p>Defined in the header storage.hpp.</p>
<h4>Template parameters</h4>
<table border="1">
<tbody>
<tr>
<th>Parameter</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><code>T</code></td>
<td>The type of object stored in the array.</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<h4>Model of</h4>
<p>Random Access Container.</p>
<h4>Type requirements</h4>
<p>None, except for those imposed by the requirements of Random
Access Container.</p>
<h4>Public base classes</h4>
<p>None.</p>
<h4>Members</h4>
<table border="1">
<tbody>
<tr>
<th>Member</th>
<th>Description</th>
</tr>
<tr>
<td><code>unbounded_array ()</code></td>
<td>Allocates an uninitialized <code>unbounded_array</code> that
holds at most zero elements.</td>
</tr>
<tr>
<td><code>unbounded_array (size_type size)</code></td>
<td>Allocates an uninitialized <code>unbounded_array</code> that
holds at most <code>size</code> elements.</td>
</tr>
<tr>
<td><code>unbounded_array (const unbounded_array
&amp;a)</code></td>
<td>The copy constructor.</td>
</tr>
<tr>
<td><code>~unbounded_array ()</code></td>
<td>Deallocates the <code>unbounded_array</code> itself.</td>
</tr>
<tr>
<td><code>void resize (size_type size)</code></td>
<td>Reallocates an <code>unbounded_array</code> to hold at most
<code>size</code> elements. The content of the
<code>unbounded_array</code> is not preserved.</td>
</tr>
<tr>
<td><code>size_type size () const</code></td>
<td>Returns the size of the <code>unbounded_array</code>.</td>
</tr>
<tr>
<td><code>const_reference operator [] (size_type i)
const</code></td>
<td>Returns a <code>const</code> reference of the <code>i</code>
-th element.</td>
</tr>
<tr>
<td><code>reference operator [] (size_type i)</code></td>
<td>Returns a reference of the <code>i</code>-th element.</td>
</tr>
<tr>
<td><code>unbounded_array &amp;operator = (const unbounded_array
&amp;a)</code></td>
<td>The assignment operator.</td>
</tr>
<tr>
<td><code>unbounded_array &amp;assign_temporary (unbounded_array
&amp;a)</code></td>
<td>Assigns a temporary. May change the array <code>a</code>.</td>
</tr>
<tr>
<td><code>void swap (unbounded_array &amp;a)</code></td>
<td>Swaps the contents of the arrays.</td>
</tr>
<tr>
<td><code>pointer insert (pointer it, const value_type
&amp;t)</code></td>
<td>Inserts the value <code>t</code> at <code>it</code>.</td>
</tr>
<tr>
<td><code>void erase (pointer it)</code></td>
<td>Erases the value at <code>it</code>.</td>
</tr>
<tr>
<td><code>void clear ()</code></td>
<td>Clears the array.</td>
</tr>
<tr>
<td><code>const_iterator begin () const</code></td>
<td>Returns a <code>const_iterator</code> pointing to the beginning
of the <code>unbounded_array</code>.</td>
</tr>
<tr>
<td><code>const_iterator end () const</code></td>
<td>Returns a <code>const_iterator</code> pointing to the end of
the <code>unbounded_array</code>.</td>
</tr>
<tr>
<td><code>iterator begin ()</code> </td>
<td>Returns a <code>iterator</code> pointing to the beginning of
the <code>unbounded_array</code>.</td>
</tr>
<tr>
<td><code>iterator end ()</code> </td>
<td>Returns a <code>iterator</code> pointing to the end of the
<code>unbounded_array</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rbegin () const</code></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the
beginning of the reversed <code>unbounded_array</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rend () const</code></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the
end of the reversed <code>unbounded_array</code>.</td>
</tr>
<tr>
<td><code>reverse_iterator rbegin ()</code> </td>
<td>Returns a <code>reverse_iterator</code> pointing to the
beginning of the reversed <code>unbounded_array</code>.</td>
</tr>
<tr>
<td><code>reverse_iterator rend ()</code> </td>
<td>Returns a <code>reverse_iterator</code> pointing to the end of
the reversed <code>unbounded_array</code>.</td>
</tr>
</tbody>
</table>
<h4>Interface</h4>
<pre>
<code>// Unbounded array<br>
template&lt;class T&gt;<br>
class unbounded_array {<br>
public:<br>
typedef std::size_t size_type;<br>
typedef std::ptrdiff_t difference_type;<br>
typedef T value_type;<br>
typedef const T &amp;const_reference;<br>
typedef T &amp;reference;<br>
typedef const T *const_pointer;<br>
typedef T *pointer;<br>
<br>
// Construction and destruction<br>
unbounded_array ();<br>
unbounded_array (size_type size);<br>
unbounded_array (const unbounded_array &amp;a);<br>
~unbounded_array ();<br>
<br>
// Resizing<br>
void resize (size_type size);<br>
<br>
size_type size () const;<br>
<br>
// Element access<br>
const_reference operator [] (size_type i) const;<br>
reference operator [] (size_type i);<br>
<br>
// Assignment<br>
unbounded_array &amp;operator = (const unbounded_array &amp;a);<br>
unbounded_array &amp;assign_temporary (unbounded_array &amp;a);<br>
<br>
// Swapping<br>
void swap (unbounded_array &amp;a);<br>
friend void swap (unbounded_array &amp;a1, unbounded_array &amp;a2);<br>
<br>
// Element insertion and deletion<br>
pointer insert (pointer it, const value_type &amp;t);<br>
void insert (pointer it, pointer it1, pointer it2);<br>
void erase (pointer it);<br>
void erase (pointer it1, pointer it2);<br>
void clear ();<br>
<br>
// Iterators simply are pointers.<br>
<br>
typedef const_pointer const_iterator;<br>
<br>
const_iterator begin () const;<br>
const_iterator end () const;<br>
<br>
typedef pointer iterator;<br>
<br>
iterator begin ();<br>
iterator end ();<br>
<br>
// Reverse iterators<br>
<br>
typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;<br>
<br>
const_reverse_iterator rbegin () const;<br>
const_reverse_iterator rend () const;<br>
<br>
typedef std::reverse_iterator&lt;iterator&gt; reverse_iterator;<br>
<br>
reverse_iterator rbegin ();<br>
reverse_iterator rend ();<br>
};<br>
<br>
template&lt;class T&gt;<br>
unbounded_array&lt;T&gt; &amp;assign_temporary (unbounded_array&lt;T&gt; &amp;a1, unbounded_array&lt;T&gt; &amp;a2);</code>
</pre>
<h2><a name="bounded_array"></a> Bounded Array</h2>
<h4>Description</h4>
<p>The templated class <code>bounded_array&lt;T, N&gt;</code>
implements a simple C-like array.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;<br>
<br>
int main () {<br>
using namespace boost::numeric::ublas;<br>
bounded_array&lt;double, 3&gt; a (3);<br>
for (unsigned i = 0; i &lt; a.size (); ++ i) {<br>
a [i] = i;<br>
std::cout &lt;&lt; a [i] &lt;&lt; std::endl;<br>
}<br>
}<br>
</pre>
<h4>Definition</h4>
<p>Defined in the header storage.hpp.</p>
<h4>Template parameters</h4>
<table border="1">
<tbody>
<tr>
<th>Parameter</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><code>T</code></td>
<td>The type of object stored in the array.</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><code>N</code></td>
<td>The allocation size of the array.</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<h4>Model of</h4>
<p>Random Access Container.</p>
<h4>Type requirements</h4>
<p>None, except for those imposed by the requirements of Random
Access Container.</p>
<h4>Public base classes</h4>
<p>None.</p>
<h4>Members</h4>
<table border="1">
<tbody>
<tr>
<th>Member</th>
<th>Description</th>
</tr>
<tr>
<td><code>bounded_array ()</code></td>
<td>Allocates an uninitialized <code>bounded_array</code> that
holds at most zero elements.</td>
</tr>
<tr>
<td><code>bounded_array (size_type size)</code></td>
<td>Allocates an uninitialized <code>bounded_array</code> that
holds at most <code>size</code> elements.</td>
</tr>
<tr>
<td><code>bounded_array (const bounded_array &amp;a)</code></td>
<td>The copy constructor.</td>
</tr>
<tr>
<td><code>~bounded_array ()</code></td>
<td>Deallocates the <code>bounded_array</code> itself.</td>
</tr>
<tr>
<td><code>void resize (size_type size)</code></td>
<td>Reallocates a <code>bounded_array</code> to hold at most
<code>size</code> elements. The content of the
<code>bounded_array</code> is preserved.</td>
</tr>
<tr>
<td><code>size_type size () const</code></td>
<td>Returns the size of the <code>bounded_array</code>.</td>
</tr>
<tr>
<td><code>const_reference operator [] (size_type i)
const</code></td>
<td>Returns a <code>const</code> reference of the <code>i</code>
-th element.</td>
</tr>
<tr>
<td><code>reference operator [] (size_type i)</code></td>
<td>Returns a reference of the <code>i</code>-th element.</td>
</tr>
<tr>
<td><code>bounded_array &amp;operator = (const bounded_array
&amp;a)</code></td>
<td>The assignment operator.</td>
</tr>
<tr>
<td><code>bounded_array &amp;assign_temporary (bounded_array
&amp;a)</code></td>
<td>Assigns a temporary. May change the array <code>a</code>.</td>
</tr>
<tr>
<td><code>void swap (bounded_array &amp;a)</code></td>
<td>Swaps the contents of the arrays.</td>
</tr>
<tr>
<td><code>pointer insert (pointer it, const value_type
&amp;t)</code></td>
<td>Inserts the value <code>t</code> at <code>it</code>.</td>
</tr>
<tr>
<td><code>void erase (pointer it)</code></td>
<td>Erases the value at <code>it</code>.</td>
</tr>
<tr>
<td><code>void clear ()</code></td>
<td>Clears the array.</td>
</tr>
<tr>
<td><code>const_iterator begin () const</code></td>
<td>Returns a <code>const_iterator</code> pointing to the beginning
of the <code>bounded_array</code>.</td>
</tr>
<tr>
<td><code>const_iterator end () const</code></td>
<td>Returns a <code>const_iterator</code> pointing to the end of
the <code>bounded_array</code>.</td>
</tr>
<tr>
<td><code>iterator begin ()</code> </td>
<td>Returns a <code>iterator</code> pointing to the beginning of
the <code>bounded_array</code>.</td>
</tr>
<tr>
<td><code>iterator end ()</code> </td>
<td>Returns a <code>iterator</code> pointing to the end of the
<code>bounded_array</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rbegin () const</code></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the
beginning of the reversed <code>bounded_array</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rend () const</code></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the
end of the reversed <code>bounded_array</code>.</td>
</tr>
<tr>
<td><code>reverse_iterator rbegin ()</code> </td>
<td>Returns a <code>reverse_iterator</code> pointing to the
beginning of the reversed <code>bounded_array</code>.</td>
</tr>
<tr>
<td><code>reverse_iterator rend ()</code> </td>
<td>Returns a <code>reverse_iterator</code> pointing to the end of
the reversed <code>bounded_array</code>.</td>
</tr>
</tbody>
</table>
<h4>Interface</h4>
<pre>
<code>// Bounded array<br>
template&lt;class T, std::size_t N&gt;<br>
class bounded_array {<br>
public:<br>
typedef std::size_t size_type;<br>
typedef std::ptrdiff_t difference_type;<br>
typedef T value_type;<br>
typedef const T &amp;const_reference;<br>
typedef T &amp;reference;<br>
typedef const T *const_pointer;<br>
typedef T *pointer;<br>
<br>
// Construction and destruction<br>
bounded_array ();<br>
bounded_array (size_type size);<br>
bounded_array (const bounded_array &amp;a);<br>
<br>
// Resizing<br>
void resize (size_type size);<br>
<br>
size_type size () const;<br>
<br>
// Element access<br>
const_reference operator [] (size_type i) const;<br>
reference operator [] (size_type i);<br>
<br>
// Assignment<br>
bounded_array &amp;operator = (const bounded_array &amp;a);<br>
bounded_array &amp;assign_temporary (bounded_array &amp;a);<br>
<br>
// Swapping<br>
void swap (bounded_array &amp;a);<br>
friend void swap (bounded_array &amp;a1, bounded_array &amp;a2);<br>
<br>
// Element insertion and deletion<br>
pointer insert (pointer it, const value_type &amp;t);<br>
void insert (pointer it, pointer it1, pointer it2);<br>
void erase (pointer it);<br>
void erase (pointer it1, pointer it2);<br>
void clear ();<br>
<br>
// Iterators simply are pointers.<br>
<br>
typedef const_pointer const_iterator;<br>
<br>
const_iterator begin () const;<br>
const_iterator end () const;<br>
<br>
typedef pointer iterator;<br>
<br>
iterator begin ();<br>
iterator end ();<br>
<br>
// Reverse iterators<br>
<br>
typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;<br>
<br>
const_reverse_iterator rbegin () const;<br>
const_reverse_iterator rend () const;<br>
<br>
typedef std::reverse_iterator&lt;iterator, value_type, reference&gt; reverse_iterator;<br>
<br>
reverse_iterator rbegin ();<br>
reverse_iterator rend ();<br>
};<br>
<br>
template&lt;class T, std::size_t N&gt;<br>
bounded_array&lt;T, N&gt; &amp;assign_temporary (bounded_array&lt;T, N&gt; &amp;a1, bounded_array&lt;T, N&gt; &amp;a2);</code>
</pre>
<h2><a name="range"></a> Range</h2>
<h4>Description</h4>
<p>The class <code>range</code> implements base functionality
needed to address ranges of vectors and matrices.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;<br>
<br>
int main () {<br>
using namespace boost::numeric::ublas;<br>
range r (0, 3);<br>
for (unsigned i = 0; i &lt; r.size (); ++ i) {<br>
std::cout &lt;&lt; r (i) &lt;&lt; std::endl;<br>
}<br>
}<br>
</pre>
<h4>Definition</h4>
<p>Defined in the header storage.hpp.</p>
<h4>Model of</h4>
<p>Reversible Container.</p>
<h4>Type requirements</h4>
<p>None, except for those imposed by the requirements of Reversible
Container.</p>
<h4>Public base classes</h4>
<p>None.</p>
<h4>Members</h4>
<table border="1">
<tbody>
<tr>
<th>Member</th>
<th>Description</th>
</tr>
<tr>
<td><code>range (size_type start, size_type stop)</code></td>
<td>Constructs a range from <code>start</code> to <code>stop</code>
.</td>
</tr>
<tr>
<td><code>size_type start () const</code></td>
<td>Returns the beginning of the <code>range</code>.</td>
</tr>
<tr>
<td><code>size_type size () const</code></td>
<td>Returns the size of the <code>range</code>.</td>
</tr>
<tr>
<td><code>const_reference operator [] (size_type i)
const</code></td>
<td>Returns the value <code>start + i</code> of the <code>i</code>
-th element.</td>
</tr>
<tr>
<td><code>range compose (const range &amp;r) const</code></td>
<td>Returns the composite range from <code>start + r.start
()</code> to <code>start + r.start () + r.size ()</code>.</td>
</tr>
<tr>
<td><code>bool operator == (const range &amp;r) const</code></td>
<td>Tests two ranges for equality.</td>
</tr>
<tr>
<td><code>bool operator != (const range &amp;r) const</code></td>
<td>Tests two ranges for inequality.</td>
</tr>
<tr>
<td><code>const_iterator begin () const</code></td>
<td>Returns a <code>const_iterator</code> pointing to the beginning
of the <code>range</code>.</td>
</tr>
<tr>
<td><code>const_iterator end () const</code></td>
<td>Returns a <code>const_iterator</code> pointing to the end of
the <code>range</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rbegin () const</code></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the
beginning of the reversed <code>range</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rend () const</code></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the
end of the reversed <code>range</code>.</td>
</tr>
</tbody>
</table>
<h4>Interface</h4>
<pre>
<code>// Range class<br>
class range {<br>
public:<br>
typedef std::size_t size_type;<br>
typedef std::ptrdiff_t difference_type;<br>
typedef difference_type value_type;<br>
typedef value_type const_reference;<br>
typedef const_reference reference;<br>
typedef const difference_type *const_pointer;<br>
typedef difference_type *pointer;<br>
typedef size_type const_iterator_type;<br>
<br>
// Construction and destruction<br>
range ();<br>
range (size_type start, size_type stop);<br>
<br>
size_type start () const;<br>
size_type size () const;<br>
<br>
// Element access<br>
const_reference operator () (size_type i) const;<br>
<br>
// Composition<br>
range compose (const range &amp;r) const;<br>
<br>
// Comparison<br>
bool operator == (const range &amp;r) const;<br>
bool operator != (const range &amp;r) const;<br>
<br>
// Iterator simply is a index.<br>
<br>
class const_iterator:<br>
public container_const_reference&lt;range&gt;,<br>
public random_access_iterator_base&lt;const_iterator, value_type&gt; {<br>
public:<br>
<br>
// Construction and destruction<br>
const_iterator ();<br>
const_iterator (const range &amp;r, const const_iterator_type &amp;it);<br>
<br>
// Arithmetic<br>
const_iterator &amp;operator ++ ();<br>
const_iterator &amp;operator -- ();<br>
const_iterator &amp;operator += (difference_type n);<br>
const_iterator &amp;operator -= (difference_type n);<br>
difference_type operator - (const const_iterator &amp;it) const;<br>
<br>
// Dereference<br>
const_reference operator * () const;<br>
<br>
// Index<br>
size_type index () const;<br>
<br>
// Assignment<br>
const_iterator &amp;operator = (const const_iterator &amp;it);<br>
<br>
// Comparison<br>
bool operator == (const const_iterator &amp;it) const;<br>
};<br>
<br>
const_iterator begin () const;<br>
const_iterator end () const;<br>
<br>
// Reverse iterator<br>
<br>
typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;<br>
<br>
const_reverse_iterator rbegin () const;<br>
const_reverse_iterator rend () const;<br>
};</code>
</pre>
<h2><a name="slice"></a> Slice</h2>
<h4>Description</h4>
<p>The class <code>slice</code> implements base functionality
needed to address slices of vectors and matrices.</p>
<h4>Example</h4>
<pre>
#include &lt;boost/numeric/ublas/storage.hpp&gt;<br>
<br>
int main () {<br>
using namespace boost::numeric::ublas;<br>
slice s (0, 1, 3);<br>
for (unsigned i = 0; i &lt; s.size (); ++ i) {<br>
std::cout &lt;&lt; s (i) &lt;&lt; std::endl;<br>
}<br>
}<br>
</pre>
<h4>Definition</h4>
<p>Defined in the header storage.hpp.</p>
<h4>Model of</h4>
<p>Reversible Container.</p>
<h4>Type requirements</h4>
<p>None, except for those imposed by the requirements of Reversible
Container.</p>
<h4>Public base classes</h4>
<p>None.</p>
<h4>Members</h4>
<table border="1">
<tbody>
<tr>
<th>Member</th>
<th>Description</th>
</tr>
<tr>
<td><code>slice (size_type start, size_type stride, size_type
size)</code></td>
<td>Constructs a slice from <code>start</code> to <code>start +
size</code> with stride <code>stride</code>.</td>
</tr>
<tr>
<td><code>size_type start () const</code></td>
<td>Returns the beginning of the <code>slice</code>.</td>
</tr>
<tr>
<td><code>size_type stride () const</code></td>
<td>Returns the stride of the <code>slice</code>.</td>
</tr>
<tr>
<td><code>size_type size () const</code></td>
<td>Returns the size of the <code>slice</code>.</td>
</tr>
<tr>
<td><code>const_reference operator [] (size_type i)
const</code></td>
<td>Returns the value <code>start + i * stride</code> of the
<code>i</code>-th element.</td>
</tr>
<tr>
<td><code>slice compose (const range &amp;r) const</code></td>
<td>Returns the composite slice from <code>start + stride * r.start
()</code> to <code>start + stride * (r.start () + r.size ())</code>
with stride <code>stride</code>.</td>
</tr>
<tr>
<td><code>slice compose (const slice &amp;s) const</code></td>
<td>Returns the composite slice from <code>start + stride * s.start
()</code> to <code>start + stride * s.stride () * (s.start () +
s.size ())</code> with stride <code>stride * s.stride ()</code>
.</td>
</tr>
<tr>
<td><code>bool operator == (const slice &amp;s) const</code></td>
<td>Tests two slices for equality.</td>
</tr>
<tr>
<td><code>bool operator != (const slice &amp;s) const</code></td>
<td>Tests two slices for inequality.</td>
</tr>
<tr>
<td><code>const_iterator begin () const</code></td>
<td>Returns a <code>const_iterator</code> pointing to the beginning
of the <code>slice</code>.</td>
</tr>
<tr>
<td><code>const_iterator end () const</code></td>
<td>Returns a <code>const_iterator</code> pointing to the end of
the <code>slice</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rbegin () const</code></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the
beginning of the reversed <code>slice</code>.</td>
</tr>
<tr>
<td><code>const_reverse_iterator rend () const</code></td>
<td>Returns a <code>const_reverse_iterator</code> pointing to the
end of the reversed <code>slice</code>.</td>
</tr>
</tbody>
</table>
<h4>Interface</h4>
<pre>
<code>// Slice class<br>
class slice {<br>
public:<br>
typedef std::size_t size_type;<br>
typedef std::ptrdiff_t difference_type;<br>
typedef difference_type value_type;<br>
typedef value_type const_reference;<br>
typedef const_reference reference;<br>
typedef const difference_type *const_pointer;<br>
typedef difference_type *pointer;<br>
typedef size_type const_iterator_type;<br>
<br>
// Construction and destruction<br>
slice ();<br>
slice (size_type start, size_type stride, size_type size);<br>
<br>
size_type start () const;<br>
size_type stride () const;<br>
size_type size () const;<br>
<br>
// Element access<br>
const_reference operator () (size_type i) const;<br>
<br>
// Composition<br>
slice compose (const range &amp;r) const;<br>
slice compose (const slice &amp;s) const;<br>
<br>
// Comparison<br>
bool operator == (const slice &amp;s) const;<br>
bool operator != (const slice &amp;s) const;<br>
<br>
// Iterator simply is a index.<br>
<br>
class const_iterator:<br>
public container_const_reference&lt;slice&gt;,<br>
public random_access_iterator_base&lt;const_iterator, value_type&gt; {<br>
public:<br>
<br>
// Construction and destruction<br>
const_iterator ();<br>
const_iterator (const slice &amp;s, const const_iterator_type &amp;it);<br>
<br>
// Arithmetic<br>
const_iterator &amp;operator ++ ();<br>
const_iterator &amp;operator -- ();<br>
const_iterator &amp;operator += (difference_type n);<br>
const_iterator &amp;operator -= (difference_type n);<br>
difference_type operator - (const const_iterator &amp;it) const;<br>
<br>
// Dereference<br>
const_reference operator * () const;<br>
<br>
// Index<br>
size_type index () const;<br>
<br>
// Assignment<br>
const_iterator &amp;operator = (const const_iterator &amp;it);<br>
<br>
// Comparison<br>
bool operator == (const const_iterator &amp;it) const;<br>
};<br>
<br>
const_iterator begin () const;<br>
const_iterator end () const;<br>
<br>
// Reverse iterator<br>
<br>
typedef std::reverse_iterator&lt;const_iterator&gt; const_reverse_iterator;<br>
<br>
const_reverse_iterator rbegin () const;<br>
const_reverse_iterator rend () const;<br>
};</code>
</pre>
<hr>
<p>Copyright (&copy;) 2000-2002 Joerg Walter, Mathias Koch<br>
Permission to copy, use, modify, sell and distribute this document
is granted provided this copyright notice appears in all copies.
This document is provided ``as is'' without express or implied
warranty, and with no claim as to its suitability for any
purpose.</p>
<p>Last revised: 1/15/2003</p>
</body>
</html>