STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Concurrency::details::_Vector_iterator< _Container, _Value > Class Template Reference

#include <concurrent_vector.h>

Public Types

typedef ptrdiff_t difference_type
 
typedef _Value value_type
 
typedef _Valuepointer
 
typedef _Valuereference
 
typedef std::random_access_iterator_tag iterator_category
 

Public Member Functions

 _Vector_iterator ()
 
 _Vector_iterator (const _Vector_iterator< _Container, typename _Container::value_type > &_Other)
 
_Vector_iterator operator+ (ptrdiff_t _Offset) const
 
_Vector_iteratoroperator+= (ptrdiff_t _Offset)
 
_Vector_iterator operator- (ptrdiff_t _Offset) const
 
_Vector_iteratoroperator-= (ptrdiff_t _Offset)
 
_Valueoperator* () const
 
_Valueoperator[] (ptrdiff_t _K) const
 
_Valueoperator-> () const
 
_Vector_iteratoroperator++ ()
 
_Vector_iteratoroperator-- ()
 
_Vector_iterator operator++ (int)
 
_Vector_iterator operator-- (int)
 

Private Member Functions

 _Vector_iterator (const _Container &_Vec, size_t _Index, void *_Ptr=NULL)
 

Private Attributes

_Container * _My_vector
 
size_t _My_index
 
_Value_My_item
 

Friends

template<typename _C , typename _U >
class ::Concurrency::details::_Vector_iterator
 
template<typename _Ty , class _Ax >
class ::Concurrency::concurrent_vector
 
template<typename _C , typename _Ty >
_Vector_iterator< _C, _Ty > operator+ (ptrdiff_t _Offset, const _Vector_iterator< _C, _Ty > &_Vec)
 
template<typename _C , typename _Ty , typename _U >
bool operator== (const _Vector_iterator< _C, _Ty > &, const _Vector_iterator< _C, _U > &)
 
template<typename _C , typename _Ty , typename _U >
bool operator< (const _Vector_iterator< _C, _Ty > &, const _Vector_iterator< _C, _U > &)
 
template<typename _C , typename _Ty , typename _U >
ptrdiff_t operator- (const _Vector_iterator< _C, _Ty > &, const _Vector_iterator< _C, _U > &)
 

Detailed Description

template<typename _Container, typename _Value>
class Concurrency::details::_Vector_iterator< _Container, _Value >

_Value is either the _Ty or const _Ty type of the container.

Member Typedef Documentation

template<typename _Container, typename _Value>
typedef ptrdiff_t Concurrency::details::_Vector_iterator< _Container, _Value >::difference_type
template<typename _Container, typename _Value>
typedef std::random_access_iterator_tag Concurrency::details::_Vector_iterator< _Container, _Value >::iterator_category
template<typename _Container, typename _Value>
typedef _Value* Concurrency::details::_Vector_iterator< _Container, _Value >::pointer
template<typename _Container, typename _Value>
typedef _Value& Concurrency::details::_Vector_iterator< _Container, _Value >::reference
template<typename _Container, typename _Value>
typedef _Value Concurrency::details::_Vector_iterator< _Container, _Value >::value_type

Constructor & Destructor Documentation

template<typename _Container, typename _Value>
Concurrency::details::_Vector_iterator< _Container, _Value >::_Vector_iterator ( const _Container &  _Vec,
size_t  _Index,
void _Ptr = NULL 
)
inlineprivate
208  : _My_vector(const_cast<_Container*>(&_Vec)),
209  _My_index(_Index),
210  _My_item(static_cast<_Value*>(_Ptr))
211  {
212  }
_Container * _My_vector
Definition: concurrent_vector.h:180
_Value * _My_item
Definition: concurrent_vector.h:187
size_t _My_index
Definition: concurrent_vector.h:183
template<typename _Container, typename _Value>
Concurrency::details::_Vector_iterator< _Container, _Value >::_Vector_iterator ( )
inline
217  : _My_vector(NULL), _My_index(~size_t(0)), _My_item(NULL)
218  {
219  }
#define NULL
Definition: vcruntime.h:236
_Container * _My_vector
Definition: concurrent_vector.h:180
_Value * _My_item
Definition: concurrent_vector.h:187
size_t _My_index
Definition: concurrent_vector.h:183
template<typename _Container, typename _Value>
Concurrency::details::_Vector_iterator< _Container, _Value >::_Vector_iterator ( const _Vector_iterator< _Container, typename _Container::value_type > &  _Other)
inline
222  : _My_vector(_Other._My_vector),
223  _My_index(_Other._My_index),
224  _My_item(_Other._My_item)
225  {
226  }
_Container * _My_vector
Definition: concurrent_vector.h:180
_Value * _My_item
Definition: concurrent_vector.h:187
size_t _My_index
Definition: concurrent_vector.h:183

Member Function Documentation

template<typename _Container, typename _Value>
_Value& Concurrency::details::_Vector_iterator< _Container, _Value >::operator* ( ) const
inline
249  {
250  _Value* _Item = _My_item;
251  if( !_Item )
252  _Item = _My_item = &_My_vector->_Internal_subscript(_My_index);
253  _CONCRT_ASSERT( _Item==&_My_vector->_Internal_subscript(_My_index)); // corrupt cache
254  return *_Item;
255  }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Container * _My_vector
Definition: concurrent_vector.h:180
_Value * _My_item
Definition: concurrent_vector.h:187
size_t _My_index
Definition: concurrent_vector.h:183
_In_ int _Value
Definition: setjmp.h:173
template<typename _Container, typename _Value>
_Vector_iterator Concurrency::details::_Vector_iterator< _Container, _Value >::operator+ ( ptrdiff_t  _Offset) const
inline
229  {
230  return _Vector_iterator( *_My_vector, _My_index+_Offset );
231  }
_Vector_iterator()
Definition: concurrent_vector.h:216
_Container * _My_vector
Definition: concurrent_vector.h:180
size_t _My_index
Definition: concurrent_vector.h:183
template<typename _Container, typename _Value>
_Vector_iterator& Concurrency::details::_Vector_iterator< _Container, _Value >::operator++ ( )
inline
267  {
268  size_t _K = ++_My_index;
269  if( _My_item )
270  {
271  // Following test uses 2's-complement wizardry.
272  if( (_K& (_K-2))==0 )
273  {
274  // _K is a power of two that is at least _K-2.
275  _My_item= NULL;
276  }
277  else
278  {
279  ++_My_item;
280  }
281  }
282  return *this;
283  }
#define NULL
Definition: vcruntime.h:236
_Value * _My_item
Definition: concurrent_vector.h:187
size_t _My_index
Definition: concurrent_vector.h:183
template<typename _Container, typename _Value>
_Vector_iterator Concurrency::details::_Vector_iterator< _Container, _Value >::operator++ ( int  )
inline
308  {
309  _Vector_iterator _Result = *this;
310  operator++();
311  return _Result;
312  }
Definition: vector:294
_Vector_iterator & operator++()
Definition: concurrent_vector.h:266
template<typename _Container, typename _Value>
_Vector_iterator& Concurrency::details::_Vector_iterator< _Container, _Value >::operator+= ( ptrdiff_t  _Offset)
inline
233  {
234  _My_index+=_Offset;
235  _My_item = NULL;
236  return *this;
237  }
#define NULL
Definition: vcruntime.h:236
_Value * _My_item
Definition: concurrent_vector.h:187
size_t _My_index
Definition: concurrent_vector.h:183
template<typename _Container, typename _Value>
_Vector_iterator Concurrency::details::_Vector_iterator< _Container, _Value >::operator- ( ptrdiff_t  _Offset) const
inline
239  {
240  return _Vector_iterator( *_My_vector, _My_index-_Offset );
241  }
_Vector_iterator()
Definition: concurrent_vector.h:216
_Container * _My_vector
Definition: concurrent_vector.h:180
size_t _My_index
Definition: concurrent_vector.h:183
template<typename _Container, typename _Value>
_Vector_iterator& Concurrency::details::_Vector_iterator< _Container, _Value >::operator-- ( )
inline
287  {
288  _CONCRT_ASSERT( _My_index>0 ); // operator--() applied to iterator already at beginning of concurrent_vector.
289  size_t _K = _My_index--;
290  if( _My_item )
291  {
292  // Following test uses 2's-complement wizardry.
293  if( (_K& (_K-2))==0 )
294  {
295  // k is a power of two that is at least k-2.
296  _My_item= NULL;
297  }
298  else
299  {
300  --_My_item;
301  }
302  }
303  return *this;
304  }
#define NULL
Definition: vcruntime.h:236
#define _CONCRT_ASSERT(x)
Definition: concrt.h:123
_Value * _My_item
Definition: concurrent_vector.h:187
size_t _My_index
Definition: concurrent_vector.h:183
template<typename _Container, typename _Value>
_Vector_iterator Concurrency::details::_Vector_iterator< _Container, _Value >::operator-- ( int  )
inline
316  {
317  _Vector_iterator _Result = *this;
318  operator--();
319  return _Result;
320  }
Definition: vector:294
_Vector_iterator & operator--()
Definition: concurrent_vector.h:286
template<typename _Container, typename _Value>
_Vector_iterator& Concurrency::details::_Vector_iterator< _Container, _Value >::operator-= ( ptrdiff_t  _Offset)
inline
243  {
244  _My_index-=_Offset;
245  _My_item = NULL;
246  return *this;
247  }
#define NULL
Definition: vcruntime.h:236
_Value * _My_item
Definition: concurrent_vector.h:187
size_t _My_index
Definition: concurrent_vector.h:183
template<typename _Container, typename _Value>
_Value* Concurrency::details::_Vector_iterator< _Container, _Value >::operator-> ( ) const
inline
261  {
262  return &operator*();
263  }
_Value & operator*() const
Definition: concurrent_vector.h:248
template<typename _Container, typename _Value>
_Value& Concurrency::details::_Vector_iterator< _Container, _Value >::operator[] ( ptrdiff_t  _K) const
inline
257  {
258  return _My_vector->_Internal_subscript(_My_index+_K);
259  }
_Container * _My_vector
Definition: concurrent_vector.h:180
size_t _My_index
Definition: concurrent_vector.h:183

Friends And Related Function Documentation

template<typename _Container, typename _Value>
template<typename _Ty , class _Ax >
friend class ::Concurrency::concurrent_vector
friend
template<typename _Container, typename _Value>
template<typename _C , typename _U >
friend class ::Concurrency::details::_Vector_iterator
friend
template<typename _Container, typename _Value>
template<typename _C , typename _Ty >
_Vector_iterator<_C,_Ty> operator+ ( ptrdiff_t  _Offset,
const _Vector_iterator< _C, _Ty > &  _Vec 
)
friend
template<typename _Container, typename _Value>
template<typename _C , typename _Ty , typename _U >
ptrdiff_t operator- ( const _Vector_iterator< _C, _Ty > &  ,
const _Vector_iterator< _C, _U > &   
)
friend
template<typename _Container, typename _Value>
template<typename _C , typename _Ty , typename _U >
bool operator< ( const _Vector_iterator< _C, _Ty > &  ,
const _Vector_iterator< _C, _U > &   
)
friend
template<typename _Container, typename _Value>
template<typename _C , typename _Ty , typename _U >
bool operator== ( const _Vector_iterator< _C, _Ty > &  ,
const _Vector_iterator< _C, _U > &   
)
friend

Member Data Documentation

template<typename _Container, typename _Value>
size_t Concurrency::details::_Vector_iterator< _Container, _Value >::_My_index
private
template<typename _Container, typename _Value>
_Value* Concurrency::details::_Vector_iterator< _Container, _Value >::_My_item
mutableprivate

NULL if cached value is not available

template<typename _Container, typename _Value>
_Container* Concurrency::details::_Vector_iterator< _Container, _Value >::_My_vector
private

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