All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | List of all members
blaze::PtrVector< T, D, G >::ConstCastIterator< C > Class Template Reference

Dynamic cast iterator for polymorphic pointer vectors.The ConstCastIterator class is part of the PtrVector class and represent a forward iterator over all elements of type C contained in a range of elements of type T, where C is a type derived from T. The ConstCastIterator is the counterpart of CastIterator for constant vectors. More...

#include <PtrVector.h>

Public Types

typedef std::forward_iterator_tag IteratorCategory
 The iterator category.
 
typedef const C * ValueType
 Type of the underlying pointers.
 
typedef const C * PointerType
 Pointer return type.
 
typedef const C *const & ReferenceType
 Reference return type.
 
typedef ptrdiff_t DifferenceType
 Difference between two iterators.
 
typedef const T *const * IteratorType
 Type of the internal pointer.
 
typedef IteratorCategory iterator_category
 The iterator category.
 
typedef ValueType value_type
 Type of the underlying pointers.
 
typedef PointerType pointer
 Pointer return type.
 
typedef ReferenceType reference
 Reference return type.
 
typedef DifferenceType difference_type
 Difference between two iterators.
 

Public Member Functions

Constructors
 ConstCastIterator ()
 Default constructor for ConstCastIterator.
 
 ConstCastIterator (IteratorType begin, IteratorType end)
 Standard constructor for ConstCastIterator. More...
 
template<typename Other >
 ConstCastIterator (const ConstCastIterator< Other > &it)
 Conversion constructor from different ConstCastIterator instances. More...
 
template<typename Other >
 ConstCastIterator (const typename PtrVector< T, D, G >::BLAZE_TEMPLATE CastIterator< Other > &it)
 Conversion constructor from CastIterator instances. More...
 
Operators
ConstCastIteratoroperator++ ()
 Pre-increment operator. More...
 
ConstCastIterator operator++ (int)
 Post-increment operator. More...
 
Access operators
PointerType operator* () const
 Returns a handle to the element at the current iterator position. More...
 
PointerType operator-> () const
 Direct access to the element at the current iterator position. More...
 
Utility functions
const IteratorTypebase () const
 Direct access to the current memory location of the constant cast iterator. More...
 
const IteratorTypestop () const
 Direct access to the final memory location of the constant cast iterator. More...
 

Private Attributes

Member variables
IteratorType cur_
 Pointer to the current memory location.
 
IteratorType end_
 Pointer to the element one past the last element in the element range.
 

Detailed Description

template<typename T, typename D = PtrDelete, typename G = OptimalGrowth>
template<typename C>
class blaze::PtrVector< T, D, G >::ConstCastIterator< C >

Dynamic cast iterator for polymorphic pointer vectors.

The ConstCastIterator class is part of the PtrVector class and represent a forward iterator over all elements of type C contained in a range of elements of type T, where C is a type derived from T. The ConstCastIterator is the counterpart of CastIterator for constant vectors.

class A { ... };
class B : public class A { ... };
// Loop over all elements of type B within the range [begin..end)
for( ; begin!=end; ++begin )
...

Note: Using a ConstCastIterator is computationally more expensive than using a standard iterator over all elements contained in the vector.

Constructor & Destructor Documentation

template<typename T , typename D , typename G >
template<typename C >
blaze::PtrVector< T, D, G >::ConstCastIterator< C >::ConstCastIterator ( IteratorType  begin,
IteratorType  end 
)
inline

Standard constructor for ConstCastIterator.

Parameters
beginThe beginning of the element range.
endThe end of the element range.
template<typename T , typename D , typename G >
template<typename C >
template<typename Other >
blaze::PtrVector< T, D, G >::ConstCastIterator< C >::ConstCastIterator ( const ConstCastIterator< Other > &  it)
inline

Conversion constructor from different ConstCastIterator instances.

Parameters
itThe foreign ConstCastIterator instance to be copied.
template<typename T, typename D, typename G>
template<typename C >
template<typename Other >
blaze::PtrVector< T, D, G >::ConstCastIterator< C >::ConstCastIterator ( const typename PtrVector< T, D, G >::BLAZE_TEMPLATE CastIterator< Other > &  it)
inline

Conversion constructor from CastIterator instances.

Parameters
itThe foreign CastIterator instance to be copied.

Member Function Documentation

template<typename T , typename D , typename G >
template<typename C >
const PtrVector< T, D, G >::BLAZE_TEMPLATE ConstCastIterator< C >::IteratorType & blaze::PtrVector< T, D, G >::ConstCastIterator< C >::base ( ) const
inline

Direct access to the current memory location of the constant cast iterator.

Returns
Pointer to the current memory location.
template<typename T , typename D , typename G >
template<typename C >
PtrVector< T, D, G >::BLAZE_TEMPLATE ConstCastIterator< C >::PointerType blaze::PtrVector< T, D, G >::ConstCastIterator< C >::operator* ( ) const
inline

Returns a handle to the element at the current iterator position.

Returns
Handle to the element at the current iterator position.
template<typename T , typename D , typename G >
template<typename C >
PtrVector< T, D, G >::BLAZE_TEMPLATE ConstCastIterator< C > & blaze::PtrVector< T, D, G >::ConstCastIterator< C >::operator++ ( )
inline

Pre-increment operator.

Returns
Reference to the incremented cast iterator.
template<typename T , typename D , typename G >
template<typename C >
PtrVector< T, D, G >::BLAZE_TEMPLATE ConstCastIterator< C > blaze::PtrVector< T, D, G >::ConstCastIterator< C >::operator++ ( int  )
inline

Post-increment operator.

Returns
The incremented cast iterator.
template<typename T , typename D , typename G >
template<typename C >
PtrVector< T, D, G >::BLAZE_TEMPLATE ConstCastIterator< C >::PointerType blaze::PtrVector< T, D, G >::ConstCastIterator< C >::operator-> ( ) const
inline

Direct access to the element at the current iterator position.

Returns
Reference to the element at the current iterator position.
template<typename T , typename D , typename G >
template<typename C >
const PtrVector< T, D, G >::BLAZE_TEMPLATE ConstCastIterator< C >::IteratorType & blaze::PtrVector< T, D, G >::ConstCastIterator< C >::stop ( ) const
inline

Direct access to the final memory location of the constant cast iterator.

Returns
Pointer to the final memory location.

The documentation for this class was generated from the following file: