Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::internal::vector_iterator< Container, Value > Class Template Reference

Meets requirements of a forward iterator for STL and a Value for a blocked_range.*/. More...

#include <concurrent_vector.h>

Collaboration diagram for tbb::internal::vector_iterator< Container, Value >:

Public Types

typedef ptrdiff_t difference_type
 
typedef Value value_type
 
typedef Value * pointer
 
typedef Value & reference
 
typedef std::random_access_iterator_tag iterator_category
 

Public Member Functions

 vector_iterator ()
 Default constructor. More...
 
 vector_iterator (const vector_iterator< Container, typename Container::value_type > &other)
 
vector_iteratoroperator= (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)
 
Value & operator * () const
 
Value & operator[] (ptrdiff_t k) const
 
Value * operator-> () const
 
vector_iteratoroperator++ ()
 Pre increment. More...
 
vector_iteratoroperator-- ()
 Pre decrement. More...
 
vector_iterator operator++ (int)
 Post increment. More...
 
vector_iterator operator-- (int)
 Post decrement. More...
 

Private Member Functions

 vector_iterator (const Container &vector, size_t index, void *ptr=0)
 

Private Attributes

Container * my_vector
 concurrent_vector over which we are iterating. More...
 
size_t my_index
 Index into the vector. More...
 
Value * my_item
 Caches my_vector->internal_subscript(my_index) More...
 

Friends

template<typename C , typename U >
class internal::vector_iterator
 
template<typename T , class A >
class tbb::concurrent_vector
 
template<typename C , typename T >
vector_iterator< C, T > operator+ (ptrdiff_t offset, const vector_iterator< C, T > &v)
 
template<typename C , typename T , typename U >
bool operator== (const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
 
template<typename C , typename T , typename U >
bool operator< (const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
 
template<typename C , typename T , typename U >
ptrdiff_t operator- (const vector_iterator< C, T > &i, const vector_iterator< C, U > &j)
 

Detailed Description

template<typename Container, typename Value>
class tbb::internal::vector_iterator< Container, Value >

Meets requirements of a forward iterator for STL and a Value for a blocked_range.*/.

Value is either the T or const T type of the container.

Definition at line 70 of file concurrent_vector.h.

Member Typedef Documentation

◆ difference_type

template<typename Container, typename Value>
typedef ptrdiff_t tbb::internal::vector_iterator< Container, Value >::difference_type

Definition at line 429 of file concurrent_vector.h.

◆ iterator_category

template<typename Container, typename Value>
typedef std::random_access_iterator_tag tbb::internal::vector_iterator< Container, Value >::iterator_category

Definition at line 433 of file concurrent_vector.h.

◆ pointer

template<typename Container, typename Value>
typedef Value* tbb::internal::vector_iterator< Container, Value >::pointer

Definition at line 431 of file concurrent_vector.h.

◆ reference

template<typename Container, typename Value>
typedef Value& tbb::internal::vector_iterator< Container, Value >::reference

Definition at line 432 of file concurrent_vector.h.

◆ value_type

template<typename Container, typename Value>
typedef Value tbb::internal::vector_iterator< Container, Value >::value_type

Definition at line 430 of file concurrent_vector.h.

Constructor & Destructor Documentation

◆ vector_iterator() [1/3]

template<typename Container, typename Value>
tbb::internal::vector_iterator< Container, Value >::vector_iterator ( const Container &  vector,
size_t  index,
void ptr = 0 
)
inlineprivate

Definition at line 328 of file concurrent_vector.h.

328  :
329  my_vector(const_cast<Container*>(&vector)),
330  my_index(index),
331  my_item(static_cast<Value*>(ptr))
332  {}
size_t my_index
Index into the vector.
Value * my_item
Caches my_vector->internal_subscript(my_index)
Container * my_vector
concurrent_vector over which we are iterating.

◆ vector_iterator() [2/3]

template<typename Container, typename Value>
tbb::internal::vector_iterator< Container, Value >::vector_iterator ( )
inline

Default constructor.

Definition at line 336 of file concurrent_vector.h.

336 : my_vector(NULL), my_index(~size_t(0)), my_item(NULL) {}
size_t my_index
Index into the vector.
Value * my_item
Caches my_vector->internal_subscript(my_index)
Container * my_vector
concurrent_vector over which we are iterating.

Referenced by tbb::internal::vector_iterator< Container, Value >::operator+(), and tbb::internal::vector_iterator< Container, Value >::operator-().

Here is the caller graph for this function:

◆ vector_iterator() [3/3]

template<typename Container, typename Value>
tbb::internal::vector_iterator< Container, Value >::vector_iterator ( const vector_iterator< Container, typename Container::value_type > &  other)
inline

Definition at line 338 of file concurrent_vector.h.

338  :
339  my_vector(other.my_vector),
340  my_index(other.my_index),
341  my_item(other.my_item)
342  {}
size_t my_index
Index into the vector.
Value * my_item
Caches my_vector->internal_subscript(my_index)
Container * my_vector
concurrent_vector over which we are iterating.

Member Function Documentation

◆ operator *()

template<typename Container, typename Value>
Value& tbb::internal::vector_iterator< Container, Value >::operator * ( ) const
inline

Definition at line 368 of file concurrent_vector.h.

368  {
369  Value* item = my_item;
370  if( !item ) {
371  item = my_item = &my_vector->internal_subscript(my_index);
372  }
373  __TBB_ASSERT( item==&my_vector->internal_subscript(my_index), "corrupt cache" );
374  return *item;
375  }
size_t my_index
Index into the vector.
Value * my_item
Caches my_vector->internal_subscript(my_index)
Container * my_vector
concurrent_vector over which we are iterating.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

References __TBB_ASSERT, tbb::internal::vector_iterator< Container, Value >::my_index, tbb::internal::vector_iterator< Container, Value >::my_item, and tbb::internal::vector_iterator< Container, Value >::my_vector.

Referenced by tbb::internal::vector_iterator< Container, Value >::operator->().

Here is the caller graph for this function:

◆ operator+()

template<typename Container, typename Value>
vector_iterator tbb::internal::vector_iterator< Container, Value >::operator+ ( ptrdiff_t  offset) const
inline

Definition at line 352 of file concurrent_vector.h.

352  {
353  return vector_iterator( *my_vector, my_index+offset );
354  }
size_t my_index
Index into the vector.
vector_iterator()
Default constructor.
Container * my_vector
concurrent_vector over which we are iterating.

References tbb::internal::vector_iterator< Container, Value >::my_index, tbb::internal::vector_iterator< Container, Value >::my_vector, and tbb::internal::vector_iterator< Container, Value >::vector_iterator().

Here is the call graph for this function:

◆ operator++() [1/2]

template<typename Container, typename Value>
vector_iterator& tbb::internal::vector_iterator< Container, Value >::operator++ ( )
inline

Pre increment.

Definition at line 382 of file concurrent_vector.h.

382  {
383  size_t element_index = ++my_index;
384  if( my_item ) {
385  //TODO: consider using of knowledge about "first_block optimization" here as well?
387  //if the iterator crosses a segment boundary, the pointer become invalid
388  //as possibly next segment is in another memory location
389  my_item= NULL;
390  } else {
391  ++my_item;
392  }
393  }
394  return *this;
395  }
size_t my_index
Index into the vector.
static bool is_first_element_in_segment(size_type element_index)
Value * my_item
Caches my_vector->internal_subscript(my_index)

References tbb::internal::concurrent_vector_base_v3::is_first_element_in_segment(), tbb::internal::vector_iterator< Container, Value >::my_index, and tbb::internal::vector_iterator< Container, Value >::my_item.

Referenced by tbb::internal::vector_iterator< Container, Value >::operator++().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator++() [2/2]

template<typename Container, typename Value>
vector_iterator tbb::internal::vector_iterator< Container, Value >::operator++ ( int  )
inline

Post increment.

Definition at line 414 of file concurrent_vector.h.

414  {
415  vector_iterator result = *this;
416  operator++();
417  return result;
418  }
vector_iterator()
Default constructor.
vector_iterator & operator++()
Pre increment.

References tbb::internal::vector_iterator< Container, Value >::operator++().

Here is the call graph for this function:

◆ operator+=()

template<typename Container, typename Value>
vector_iterator& tbb::internal::vector_iterator< Container, Value >::operator+= ( ptrdiff_t  offset)
inline

Definition at line 355 of file concurrent_vector.h.

355  {
356  my_index+=offset;
357  my_item = NULL;
358  return *this;
359  }
size_t my_index
Index into the vector.
Value * my_item
Caches my_vector->internal_subscript(my_index)

References tbb::internal::vector_iterator< Container, Value >::my_index, and tbb::internal::vector_iterator< Container, Value >::my_item.

◆ operator-()

template<typename Container, typename Value>
vector_iterator tbb::internal::vector_iterator< Container, Value >::operator- ( ptrdiff_t  offset) const
inline

Definition at line 360 of file concurrent_vector.h.

360  {
361  return vector_iterator( *my_vector, my_index-offset );
362  }
size_t my_index
Index into the vector.
vector_iterator()
Default constructor.
Container * my_vector
concurrent_vector over which we are iterating.

References tbb::internal::vector_iterator< Container, Value >::my_index, tbb::internal::vector_iterator< Container, Value >::my_vector, and tbb::internal::vector_iterator< Container, Value >::vector_iterator().

Here is the call graph for this function:

◆ operator--() [1/2]

template<typename Container, typename Value>
vector_iterator& tbb::internal::vector_iterator< Container, Value >::operator-- ( )
inline

Pre decrement.

Definition at line 398 of file concurrent_vector.h.

398  {
399  __TBB_ASSERT( my_index>0, "operator--() applied to iterator already at beginning of concurrent_vector" );
400  size_t element_index = my_index--;
401  if( my_item ) {
403  //if the iterator crosses a segment boundary, the pointer become invalid
404  //as possibly next segment is in another memory location
405  my_item= NULL;
406  } else {
407  --my_item;
408  }
409  }
410  return *this;
411  }
size_t my_index
Index into the vector.
static bool is_first_element_in_segment(size_type element_index)
Value * my_item
Caches my_vector->internal_subscript(my_index)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165

References __TBB_ASSERT, tbb::internal::concurrent_vector_base_v3::is_first_element_in_segment(), tbb::internal::vector_iterator< Container, Value >::my_index, and tbb::internal::vector_iterator< Container, Value >::my_item.

Referenced by tbb::internal::vector_iterator< Container, Value >::operator--().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator--() [2/2]

template<typename Container, typename Value>
vector_iterator tbb::internal::vector_iterator< Container, Value >::operator-- ( int  )
inline

Post decrement.

Definition at line 421 of file concurrent_vector.h.

421  {
422  vector_iterator result = *this;
423  operator--();
424  return result;
425  }
vector_iterator()
Default constructor.
vector_iterator & operator--()
Pre decrement.

References tbb::internal::vector_iterator< Container, Value >::operator--().

Here is the call graph for this function:

◆ operator-=()

template<typename Container, typename Value>
vector_iterator& tbb::internal::vector_iterator< Container, Value >::operator-= ( ptrdiff_t  offset)
inline

Definition at line 363 of file concurrent_vector.h.

363  {
364  my_index-=offset;
365  my_item = NULL;
366  return *this;
367  }
size_t my_index
Index into the vector.
Value * my_item
Caches my_vector->internal_subscript(my_index)

References tbb::internal::vector_iterator< Container, Value >::my_index, and tbb::internal::vector_iterator< Container, Value >::my_item.

◆ operator->()

template<typename Container, typename Value>
Value* tbb::internal::vector_iterator< Container, Value >::operator-> ( ) const
inline

Definition at line 379 of file concurrent_vector.h.

379 {return &operator*();}

References tbb::internal::vector_iterator< Container, Value >::operator *().

Here is the call graph for this function:

◆ operator=()

template<typename Container, typename Value>
vector_iterator& tbb::internal::vector_iterator< Container, Value >::operator= ( const vector_iterator< Container, typename Container::value_type > &  other)
inline

Definition at line 344 of file concurrent_vector.h.

345  {
346  my_vector=other.my_vector;
347  my_index=other.my_index;
348  my_item=other.my_item;
349  return *this;
350  }
size_t my_index
Index into the vector.
Value * my_item
Caches my_vector->internal_subscript(my_index)
Container * my_vector
concurrent_vector over which we are iterating.

References tbb::internal::vector_iterator< Container, Value >::my_index, tbb::internal::vector_iterator< Container, Value >::my_item, and tbb::internal::vector_iterator< Container, Value >::my_vector.

◆ operator[]()

template<typename Container, typename Value>
Value& tbb::internal::vector_iterator< Container, Value >::operator[] ( ptrdiff_t  k) const
inline

Definition at line 376 of file concurrent_vector.h.

376  {
377  return my_vector->internal_subscript(my_index+k);
378  }
size_t my_index
Index into the vector.
Container * my_vector
concurrent_vector over which we are iterating.

References tbb::internal::vector_iterator< Container, Value >::my_index, and tbb::internal::vector_iterator< Container, Value >::my_vector.

Friends And Related Function Documentation

◆ internal::vector_iterator

template<typename Container, typename Value>
template<typename C , typename U >
friend class internal::vector_iterator
friend

Definition at line 319 of file concurrent_vector.h.

◆ operator+

template<typename Container, typename Value>
template<typename C , typename T >
vector_iterator<C,T> operator+ ( ptrdiff_t  offset,
const vector_iterator< C, T > &  v 
)
friend

◆ operator-

template<typename Container, typename Value>
template<typename C , typename T , typename U >
ptrdiff_t operator- ( const vector_iterator< C, T > &  i,
const vector_iterator< C, U > &  j 
)
friend

◆ operator<

template<typename Container, typename Value>
template<typename C , typename T , typename U >
bool operator< ( const vector_iterator< C, T > &  i,
const vector_iterator< C, U > &  j 
)
friend

◆ operator==

template<typename Container, typename Value>
template<typename C , typename T , typename U >
bool operator== ( const vector_iterator< C, T > &  i,
const vector_iterator< C, U > &  j 
)
friend

◆ tbb::concurrent_vector

template<typename Container, typename Value>
template<typename T , class A >
friend class tbb::concurrent_vector
friend

Definition at line 323 of file concurrent_vector.h.

Member Data Documentation

◆ my_index

◆ my_item

◆ my_vector


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

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.