...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A vector referencing a non continuous subvector of elements given another vector of indices. More...
Inherits vector_expression< vector_indirect< V, IA > >.
Classes | |
class | const_iterator |
class | iterator |
Public Types | |
typedef const V | const_vector_type |
typedef V | vector_type |
typedef const IA | const_indirect_array_type |
typedef IA | indirect_array_type |
typedef V::size_type | size_type |
typedef V::difference_type | difference_type |
typedef V::value_type | value_type |
typedef V::const_reference | const_reference |
typedef boost::mpl::if_ < boost::is_const< V > , typename V::const_reference, typename V::reference >::type | reference |
typedef boost::mpl::if_ < boost::is_const< V > , typename V::const_closure_type, typename V::closure_type > ::type | vector_closure_type |
typedef basic_range< size_type, difference_type > | range_type |
typedef basic_slice< size_type, difference_type > | slice_type |
typedef const self_type | const_closure_type |
typedef self_type | closure_type |
typedef storage_restrict_traits < typename V::storage_category, dense_proxy_tag > ::storage_category | storage_category |
typedef reverse_iterator_base < const_iterator > | const_reverse_iterator |
typedef reverse_iterator_base < iterator > | reverse_iterator |
Public Member Functions | |
BOOST_UBLAS_INLINE | vector_indirect (vector_type &data, size_type size) |
BOOST_UBLAS_INLINE | vector_indirect (vector_type &data, const indirect_array_type &ia) |
BOOST_UBLAS_INLINE | vector_indirect (const vector_closure_type &data, const indirect_array_type &ia, int) |
BOOST_UBLAS_INLINE size_type | size () const |
BOOST_UBLAS_INLINE const_indirect_array_type & | indirect () const |
BOOST_UBLAS_INLINE indirect_array_type & | indirect () |
BOOST_UBLAS_INLINE const vector_closure_type & | data () const |
BOOST_UBLAS_INLINE vector_closure_type & | data () |
BOOST_UBLAS_INLINE const_reference | operator() (size_type i) const |
BOOST_UBLAS_INLINE reference | operator() (size_type i) |
BOOST_UBLAS_INLINE const_reference | operator[] (size_type i) const |
BOOST_UBLAS_INLINE reference | operator[] (size_type i) |
BOOST_UBLAS_INLINE vector_indirect< vector_type, indirect_array_type > | project (const range_type &r) const |
BOOST_UBLAS_INLINE vector_indirect< vector_type, indirect_array_type > | project (const slice_type &s) const |
BOOST_UBLAS_INLINE vector_indirect< vector_type, indirect_array_type > | project (const indirect_array_type &ia) const |
BOOST_UBLAS_INLINE vector_indirect & | operator= (const vector_indirect &vi) |
BOOST_UBLAS_INLINE vector_indirect & | assign_temporary (vector_indirect &vi) |
template<class AE > | |
BOOST_UBLAS_INLINE vector_indirect & | operator= (const vector_expression< AE > &ae) |
template<class AE > | |
BOOST_UBLAS_INLINE vector_indirect & | assign (const vector_expression< AE > &ae) |
template<class AE > | |
BOOST_UBLAS_INLINE vector_indirect & | operator+= (const vector_expression< AE > &ae) |
template<class AE > | |
BOOST_UBLAS_INLINE vector_indirect & | plus_assign (const vector_expression< AE > &ae) |
template<class AE > | |
BOOST_UBLAS_INLINE vector_indirect & | operator-= (const vector_expression< AE > &ae) |
template<class AE > | |
BOOST_UBLAS_INLINE vector_indirect & | minus_assign (const vector_expression< AE > &ae) |
template<class AT > | |
BOOST_UBLAS_INLINE vector_indirect & | operator*= (const AT &at) |
template<class AT > | |
BOOST_UBLAS_INLINE vector_indirect & | operator/= (const AT &at) |
BOOST_UBLAS_INLINE bool | same_closure (const vector_indirect &vr) const |
BOOST_UBLAS_INLINE bool | operator== (const vector_indirect &vi) const |
BOOST_UBLAS_INLINE void | swap (vector_indirect vi) |
BOOST_UBLAS_INLINE const_iterator | find (size_type i) const |
BOOST_UBLAS_INLINE iterator | find (size_type i) |
BOOST_UBLAS_INLINE const_iterator | begin () const |
BOOST_UBLAS_INLINE const_iterator | end () const |
BOOST_UBLAS_INLINE iterator | begin () |
BOOST_UBLAS_INLINE iterator | end () |
BOOST_UBLAS_INLINE const_reverse_iterator | rbegin () const |
BOOST_UBLAS_INLINE const_reverse_iterator | rend () const |
BOOST_UBLAS_INLINE reverse_iterator | rbegin () |
BOOST_UBLAS_INLINE reverse_iterator | rend () |
Friends | |
BOOST_UBLAS_INLINE friend void | swap (vector_indirect vi1, vector_indirect vi2) |
It is the most general version of any subvectors because it uses another vector of indices to reference the subvector.
The vector of indices can be of any type with the restriction that its elements must be type-compatible with the size_type of
the container. In practice, the following are good candidates:
boost::numeric::ublas::indirect_array<A>
where A
can be int
, size_t
, long
, etc...std::vector<A>
where A
can int
, size_t
, long
, etc...boost::numeric::ublas::vector<int>
can work too (int
can be replaced by another integer type)An indirect vector can be used as a normal vector in any expression. If the specified indirect vector falls outside that of the indices of the vector, then the vector_indirect
is not a well formed Vector Expression and access to an element outside of indices of the vector is undefined.