Encapsulation of two pointers from any random access container. More...
#include <tpie/array_view.h>
Inherits tpie::array_view_base< T >.
Public Types | |
typedef T | value_type |
Type of values contained in the array. More... | |
Public Member Functions | |
array_view (const array_view &o) | |
Copy constructor. More... | |
template<typename A > | |
array_view (std::vector< T, A > &v) | |
std::vector constructor. More... | |
array_view (tpie::array< T > &v) | |
tpie::array constructor. More... | |
array_view (tpie::internal_vector< T > &v) | |
tpie::internal_vector constructor. More... | |
template<typename A > | |
array_view (std::vector< T, A > &v, size_t start, size_t end) | |
std::vector subsequence. More... | |
array_view (tpie::array< T > &v, size_t start, size_t end) | |
tpie::array subsequence. More... | |
array_view (T *start, T *end) | |
Pointer constructor. More... | |
array_view (T *start, size_t size) | |
Pointer+offset constructor. More... | |
iterator | find (size_t idx) const throw () |
Return an iterator to the i'th element of the array. More... | |
T & | at (size_t i) const throw () |
Return the element located at the given index. More... | |
bool | empty () const |
Check if the array is empty. More... | |
size_t | size () const |
Get number of elements in the array. More... | |
T & | operator[] (size_t i) const |
Return a reference to an array entry. More... | |
bool | operator== (const array_view_base &other) const |
Check if the other array has the same elements in the same order as this. More... | |
bool | operator!= (const array_view_base &other) const |
Check if the two arrays differ. More... | |
iterator | begin () const |
Return an iterator to the beginning of the array. More... | |
iterator | end () const |
Return an iterator to the end of the array. More... | |
T & | front () const |
Return the first element in the array. More... | |
T & | back () const |
Return the last element in the array. More... | |
Encapsulation of two pointers from any random access container.
Like std::vector, tpie::array and others, this class has begin(), end() iterators and front(), back() accessors. However, an array_view does not store data, it just stores pointers to data owned by other random access data structures. Passing around array_views, one avoids having the container type as a template parameter in one's code, but the code will still work with any supported random access container.
Definition at line 47 of file array_view.h.
|
inherited |
Type of values contained in the array.
Definition at line 73 of file array_view_base.h.
|
inline |
|
inline |
std::vector constructor.
Definition at line 59 of file array_view.h.
|
inline |
tpie::array constructor.
Definition at line 65 of file array_view.h.
|
inline |
tpie::internal_vector constructor.
Definition at line 71 of file array_view.h.
|
inline |
std::vector subsequence.
v | The std::vector that stores the elements. |
start | The index of the first element of the view (such that view.front() == v[start]). |
end | Index past the last element of the view (such that view.back() == v[end-1]). |
Definition at line 81 of file array_view.h.
|
inline |
tpie::array subsequence.
v | The tpie::array that stores the elements. |
start | The index of the first element of the view (such that view.front() == v[start]). |
end | Index past the last element of the view (such that view.back() == v[end-1]). |
Definition at line 90 of file array_view.h.
|
inline |
Pointer constructor.
The structure will produce the elements in the memory range [start, end).
start | Pointer to first element of the array_view. |
end | Pointer past the last element of the array_view. |
Definition at line 97 of file array_view.h.
|
inline |
Pointer+offset constructor.
The array_view will produce the elements in the memory range [start, start+size).
start | Pointer to first element of the array_view. |
size | Number of elements in the array_view. |
Definition at line 106 of file array_view.h.
|
inlineinherited |
Return the element located at the given index.
i | The index of the element returned. |
Definition at line 91 of file array_view_base.h.
Referenced by tpie::array_view_base< const T >::operator!=(), tpie::array_view_base< const T >::operator==(), and tpie::array_view_base< const T >::operator[]().
|
inlineinherited |
Return the last element in the array.
Definition at line 167 of file array_view_base.h.
|
inlineinherited |
Return an iterator to the beginning of the array.
Definition at line 150 of file array_view_base.h.
|
inlineinherited |
Check if the array is empty.
Definition at line 101 of file array_view_base.h.
|
inlineinherited |
Return an iterator to the end of the array.
Definition at line 157 of file array_view_base.h.
|
inlineinherited |
Return an iterator to the i'th element of the array.
i | The index of the element we want an iterator to. |
Definition at line 81 of file array_view_base.h.
Referenced by tpie::array_view_base< const T >::at().
|
inlineinherited |
Return the first element in the array.
Definition at line 162 of file array_view_base.h.
|
inlineinherited |
Check if the two arrays differ.
other | The array to compare against. |
Definition at line 139 of file array_view_base.h.
|
inlineinherited |
Check if the other array has the same elements in the same order as this.
other | The array to compare against. |
Definition at line 127 of file array_view_base.h.
|
inlineinherited |
Return a reference to an array entry.
i | The index of the entry to return. |
Definition at line 115 of file array_view_base.h.
|
inlineinherited |
Get number of elements in the array.
Definition at line 107 of file array_view_base.h.
Referenced by tpie::array_view_base< const T >::at(), tpie::pipelining::parallel_bits::consumer_impl< Input, Output, dest_t >::consume(), tpie::array_view_base< const T >::find(), tpie::array_view_base< const T >::operator!=(), tpie::array_view_base< const T >::operator==(), tpie::array_view_base< const T >::operator[](), and tpie::pipelining::parallel_bits::before_impl< dest_t >::push_all().