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
206  : _My_vector(const_cast<_Container*>(&_Vec)),
207  _My_index(_Index),
208  _My_item(static_cast<_Value*>(_Ptr))
209  {
210  }
_Container * _My_vector
Definition: concurrent_vector.h:178
_Value * _My_item
Definition: concurrent_vector.h:185
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
Concurrency::details::_Vector_iterator< _Container, _Value >::_Vector_iterator ( )
inline
215  : _My_vector(NULL), _My_index(~size_t(0)), _My_item(NULL)
216  {
217  }
#define NULL
Definition: crtdbg.h:30
_Container * _My_vector
Definition: concurrent_vector.h:178
_Value * _My_item
Definition: concurrent_vector.h:185
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
Concurrency::details::_Vector_iterator< _Container, _Value >::_Vector_iterator ( const _Vector_iterator< _Container, typename _Container::value_type > &  _Other)
inline
220  : _My_vector(_Other._My_vector),
221  _My_index(_Other._My_index),
222  _My_item(_Other._My_item)
223  {
224  }
_Container * _My_vector
Definition: concurrent_vector.h:178
_Value * _My_item
Definition: concurrent_vector.h:185
size_t _My_index
Definition: concurrent_vector.h:181

Member Function Documentation

template<typename _Container, typename _Value>
_Value& Concurrency::details::_Vector_iterator< _Container, _Value >::operator* ( ) const
inline
247  {
248  _Value* _Item = _My_item;
249  if( !_Item )
250  _Item = _My_item = &_My_vector->_Internal_subscript(_My_index);
251  _CONCRT_ASSERT( _Item==&_My_vector->_Internal_subscript(_My_index)); // corrupt cache
252  return *_Item;
253  }
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
_Container * _My_vector
Definition: concurrent_vector.h:178
_Value * _My_item
Definition: concurrent_vector.h:185
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
_Vector_iterator Concurrency::details::_Vector_iterator< _Container, _Value >::operator+ ( ptrdiff_t  _Offset) const
inline
227  {
229  }
_Check_return_opt_ _In_ long _Offset
Definition: io.h:334
_Vector_iterator()
Definition: concurrent_vector.h:214
_Container * _My_vector
Definition: concurrent_vector.h:178
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
_Vector_iterator& Concurrency::details::_Vector_iterator< _Container, _Value >::operator++ ( )
inline
265  {
266  size_t _K = ++_My_index;
267  if( _My_item )
268  {
269  // Following test uses 2's-complement wizardry.
270  if( (_K& (_K-2))==0 )
271  {
272  // _K is a power of two that is at least _K-2.
273  _My_item= NULL;
274  }
275  else
276  {
277  ++_My_item;
278  }
279  }
280  return *this;
281  }
#define NULL
Definition: crtdbg.h:30
_Value * _My_item
Definition: concurrent_vector.h:185
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
_Vector_iterator Concurrency::details::_Vector_iterator< _Container, _Value >::operator++ ( int  )
inline
306  {
307  _Vector_iterator _Result = *this;
308  operator++();
309  return _Result;
310  }
Definition: vector:287
_Vector_iterator & operator++()
Definition: concurrent_vector.h:264
template<typename _Container, typename _Value>
_Vector_iterator& Concurrency::details::_Vector_iterator< _Container, _Value >::operator+= ( ptrdiff_t  _Offset)
inline
231  {
233  _My_item = NULL;
234  return *this;
235  }
_Check_return_opt_ _In_ long _Offset
Definition: io.h:334
#define NULL
Definition: crtdbg.h:30
_Value * _My_item
Definition: concurrent_vector.h:185
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
_Vector_iterator Concurrency::details::_Vector_iterator< _Container, _Value >::operator- ( ptrdiff_t  _Offset) const
inline
237  {
239  }
_Check_return_opt_ _In_ long _Offset
Definition: io.h:334
_Vector_iterator()
Definition: concurrent_vector.h:214
_Container * _My_vector
Definition: concurrent_vector.h:178
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
_Vector_iterator& Concurrency::details::_Vector_iterator< _Container, _Value >::operator-- ( )
inline
285  {
286  _CONCRT_ASSERT( _My_index>0 ); // operator--() applied to iterator already at beginning of concurrent_vector.
287  size_t _K = _My_index--;
288  if( _My_item )
289  {
290  // Following test uses 2's-complement wizardry.
291  if( (_K& (_K-2))==0 )
292  {
293  // k is a power of two that is at least k-2.
294  _My_item= NULL;
295  }
296  else
297  {
298  --_My_item;
299  }
300  }
301  return *this;
302  }
#define _CONCRT_ASSERT(x)
Definition: concrt.h:137
#define NULL
Definition: crtdbg.h:30
_Value * _My_item
Definition: concurrent_vector.h:185
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
_Vector_iterator Concurrency::details::_Vector_iterator< _Container, _Value >::operator-- ( int  )
inline
314  {
315  _Vector_iterator _Result = *this;
316  operator--();
317  return _Result;
318  }
Definition: vector:287
_Vector_iterator & operator--()
Definition: concurrent_vector.h:284
template<typename _Container, typename _Value>
_Vector_iterator& Concurrency::details::_Vector_iterator< _Container, _Value >::operator-= ( ptrdiff_t  _Offset)
inline
241  {
243  _My_item = NULL;
244  return *this;
245  }
_Check_return_opt_ _In_ long _Offset
Definition: io.h:334
#define NULL
Definition: crtdbg.h:30
_Value * _My_item
Definition: concurrent_vector.h:185
size_t _My_index
Definition: concurrent_vector.h:181
template<typename _Container, typename _Value>
_Value* Concurrency::details::_Vector_iterator< _Container, _Value >::operator-> ( ) const
inline
259  {
260  return &operator*();
261  }
_Value & operator*() const
Definition: concurrent_vector.h:246
template<typename _Container, typename _Value>
_Value& Concurrency::details::_Vector_iterator< _Container, _Value >::operator[] ( ptrdiff_t  _K) const
inline
255  {
256  return _My_vector->_Internal_subscript(_My_index+_K);
257  }
_Container * _My_vector
Definition: concurrent_vector.h:178
size_t _My_index
Definition: concurrent_vector.h:181

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: