Intel Threading Building Blocks 2.1 for Open Source

Classes | Public Types | Public Member Functions | Friends

tbb::concurrent_vector< T, A > Class Template Reference
[Containers]

#include <concurrent_vector.h>

Inheritance diagram for tbb::concurrent_vector< T, A >:
Inheritance graph
[legend]

List of all members.

Classes

class  generic_range_type
class  internal_loop_guide
 Exception-aware helper class for filling a segment by exception-danger operators of user class.

Public Types

typedef
internal::allocator_base< T, A >
::allocator_type 
allocator_type
typedef
internal::vector_iterator
< concurrent_vector, const T
const_iterator
typedef const Tconst_pointer
typedef generic_range_type
< const_iterator
const_range_type
typedef const Tconst_reference
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
typedef ptrdiff_t difference_type
typedef
internal::vector_iterator
< concurrent_vector, T
iterator
typedef Tpointer
typedef generic_range_type
< iterator
range_type
typedef Treference
typedef std::reverse_iterator
< iterator
reverse_iterator
typedef
internal::concurrent_vector_base_v3::size_type 
size_type
typedef T value_type

Public Member Functions

void assign (size_type n, const_reference t)
 assign n items by copying t item
template<class I >
void assign (I first, I last)
 assign range [first, last)
reference at (size_type index)
 Get reference to element at given index. Throws exceptions on errors.
const_reference at (size_type index) const
 Get const reference to element at given index. Throws exceptions on errors.
const_reference back () const
 the last item const
reference back ()
 the last item
iterator begin ()
 start iterator
const_iterator begin () const
 start const iterator
size_type capacity () const
 Maximum size to which array can grow without allocating more memory. Concurrent allocations are not included in the value.
const_iterator cbegin () const
 start const iterator
const_iterator cend () const
 end const iterator
void clear ()
 Clear container while keeping memory allocated.
 concurrent_vector (const concurrent_vector &vector, const allocator_type &a=allocator_type())
 Copying constructor.
 concurrent_vector (size_type n)
 Construction with initial size specified by argument n.
 concurrent_vector (size_type n, const_reference t, const allocator_type &a=allocator_type())
 Construction with initial size specified by argument n, initialization by copying of t, and given allocator instance.
 concurrent_vector (const allocator_type &a=allocator_type())
 Construct empty vector.
template<class I >
 concurrent_vector (I first, I last, const allocator_type &a=allocator_type())
 Construction with copying iteration range and given allocator instance.
template<class M >
 concurrent_vector (const concurrent_vector< T, M > &vector, const allocator_type &a=allocator_type())
 Copying constructor for vector with different allocator type.
const_reverse_iterator crbegin () const
 reverse start const iterator
const_reverse_iterator crend () const
 reverse end const iterator
bool empty () const
 Return true if vector is not empty or has elements under construction at least.
iterator end ()
 end iterator
const_iterator end () const
 end const iterator
reference front ()
 the first item
const_reference front () const
 the first item const
allocator_type get_allocator () const
 return allocator object
iterator grow_by (size_type delta)
 Grow by "delta" elements.
iterator grow_by (size_type delta, const_reference t)
 Grow by "delta" elements using copying constuctor.
iterator grow_to_at_least (size_type n)
 Append minimal sequence of elements such that size()>=n.
const
internal::concurrent_vector_base_v3 & 
internal_vector_base () const
size_type max_size () const
 Upper bound on argument to reserve.
template<class M >
concurrent_vectoroperator= (const concurrent_vector< T, M > &vector)
 Assignment for vector with different allocator type.
concurrent_vectoroperator= (const concurrent_vector &vector)
 Assignment.
reference operator[] (size_type index)
 Get reference to element at given index.
const_reference operator[] (size_type index) const
 Get const reference to element at given index.
iterator push_back (const_reference item)
 Push item.
range_type range (size_t grainsize=1)
 Get range for iterating with parallel algorithms.
const_range_type range (size_t grainsize=1) const
 Get const range for iterating with parallel algorithms.
reverse_iterator rbegin ()
 reverse start iterator
const_reverse_iterator rbegin () const
 reverse start const iterator
reverse_iterator rend ()
 reverse end iterator
const_reverse_iterator rend () const
 reverse end const iterator
void reserve (size_type n)
 Allocate enough space to grow to size n without having to allocate more memory later.
void resize (size_type n)
 Resize the vector. Not thread-safe.
void resize (size_type n, const_reference t)
 Resize the vector, copy t for new elements. Not thread-safe.
void shrink_to_fit ()
 Optimize memory usage and fragmentation.
size_type size () const
 Return size of vector. It may include elements under construction.
void swap (concurrent_vector &vector)
 swap two instances
 ~concurrent_vector ()
 Clear and destroy vector.

Friends

class internal::vector_iterator

Detailed Description

template<typename T, class A>
class tbb::concurrent_vector< T, A >

Concurrent vector container concurrent_vector is a container having the following main properties:

Compatibility
The class meets all Container Requirements and Reversible Container Requirements from C++ Standard (See ISO/IEC 14882:2003(E), clause 23.1). But it doesn't meet Sequence Requirements due to absence of insert() and erase() methods.
Exception Safety
Methods working with memory allocation and/or new elements construction can throw an exception if allocator fails to allocate memory or element's default constructor throws one. Concurrent vector's element of type T must conform to the following requirements:
  • Throwing an exception is forbidden for destructor of T.
  • Default constructor of T must not throw an exception OR its non-virtual destructor must safely work when its object memory is zero-initialized.
Otherwise, the program's behavior is undefined.
If an exception happens inside growth or assignment operation, an instance of the vector becomes invalid unless it is stated otherwise in the method documentation. Invalid state means:
  • There are no guaranties that all items were initialized by a constructor. The rest of items is zero-filled, including item where exception happens.
  • An invalid vector instance cannot be repaired; it is unable to grow anymore.
  • Size and capacity reported by the vector are incorrect, and calculated as if the failed operation were successful.
  • Attempt to access not allocated elements using operator[] or iterators results in access violation or segmentation fault exception, and in case of using at() method a C++ exception is thrown.
If a concurrent grow operation successfully completes, all the elements it has added to the vector will remain valid and accessible even if one of subsequent grow operations fails.
Fragmentation
Unlike an STL vector, a concurrent_vector does not move existing elements if it needs to allocate more memory. The container is divided into a series of contiguous arrays of elements. The first reservation, growth, or assignment operation determines the size of the first array. Using small number of elements as initial size incurs fragmentation that may increase element access time. Internal layout can be optimized by method compact() that merges several smaller arrays into one solid.
Changes since TBB 2.1
  • Fixed guarantees of concurrent_vector::size() and grow_to_at_least() methods to assure elements are allocated.
  • Methods end()/rbegin()/back() are partly thread-safe since they use size() to get the end of vector
  • Added resize() methods (not thread-safe)
  • Added cbegin/cend/crbegin/crend methods
  • Changed return type of methods grow* and push_back to iterator
Changes since TBB 2.0
  • Implemented exception-safety guaranties
  • Added template argument for allocator
  • Added allocator argument in constructors
  • Faster index calculation
  • First growth call specifies a number of segments to be merged in the first allocation.
  • Fixed memory blow up for swarm of vector's instances of small size
  • Added grow_by(size_type n, const_reference t) growth using copying constructor to init new items.
  • Added STL-like constructors.
  • Added operators ==, < and derivatives
  • Added at() method, approved for using after an exception was thrown inside the vector
  • Added get_allocator() method.
  • Added assign() methods
  • Added compact() method to defragment first segments
  • Added swap() method
  • range() defaults on grainsize = 1 supporting auto grainsize algorithms.

Definition at line 450 of file concurrent_vector.h.


Member Typedef Documentation

template<typename T, class A>
typedef internal::allocator_base<T, A>::allocator_type tbb::concurrent_vector< T, A >::allocator_type

Definition at line 474 of file concurrent_vector.h.

template<typename T, class A>
typedef internal::vector_iterator<concurrent_vector,const T> tbb::concurrent_vector< T, A >::const_iterator

Definition at line 484 of file concurrent_vector.h.

template<typename T, class A>
typedef const T* tbb::concurrent_vector< T, A >::const_pointer

Definition at line 481 of file concurrent_vector.h.

template<typename T, class A>
typedef generic_range_type<const_iterator> tbb::concurrent_vector< T, A >::const_range_type

Definition at line 500 of file concurrent_vector.h.

template<typename T, class A>
typedef const T& tbb::concurrent_vector< T, A >::const_reference

Definition at line 479 of file concurrent_vector.h.

template<typename T, class A>
typedef std::reverse_iterator<const_iterator> tbb::concurrent_vector< T, A >::const_reverse_iterator

Definition at line 489 of file concurrent_vector.h.

template<typename T, class A>
typedef ptrdiff_t tbb::concurrent_vector< T, A >::difference_type

Definition at line 477 of file concurrent_vector.h.

template<typename T, class A>
typedef internal::vector_iterator<concurrent_vector,T> tbb::concurrent_vector< T, A >::iterator

Definition at line 483 of file concurrent_vector.h.

template<typename T, class A>
typedef T* tbb::concurrent_vector< T, A >::pointer

Definition at line 480 of file concurrent_vector.h.

template<typename T, class A>
typedef generic_range_type<iterator> tbb::concurrent_vector< T, A >::range_type

Definition at line 499 of file concurrent_vector.h.

template<typename T, class A>
typedef T& tbb::concurrent_vector< T, A >::reference

Definition at line 478 of file concurrent_vector.h.

template<typename T, class A>
typedef std::reverse_iterator<iterator> tbb::concurrent_vector< T, A >::reverse_iterator

Definition at line 488 of file concurrent_vector.h.

template<typename T, class A>
typedef internal::concurrent_vector_base_v3::size_type tbb::concurrent_vector< T, A >::size_type

Definition at line 473 of file concurrent_vector.h.

template<typename T, class A>
typedef T tbb::concurrent_vector< T, A >::value_type

Definition at line 476 of file concurrent_vector.h.


Constructor & Destructor Documentation

template<typename T, class A>
tbb::concurrent_vector< T, A >::concurrent_vector ( const allocator_type a = allocator_type()  )  [inline, explicit]

Definition at line 507 of file concurrent_vector.h.

        : internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
    {
        vector_allocator_ptr = &internal_allocator;
    }

template<typename T, class A>
tbb::concurrent_vector< T, A >::concurrent_vector ( const concurrent_vector< T, A > &  vector,
const allocator_type a = allocator_type() 
) [inline]

Definition at line 514 of file concurrent_vector.h.

        : internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
    {
        vector_allocator_ptr = &internal_allocator;
        __TBB_TRY {
            internal_copy(vector, sizeof(T), &copy_array);
        } __TBB_CATCH(...) {
            segment_t *table = my_segment;
            internal_free_segments( reinterpret_cast<void**>(table), internal_clear(&destroy_array), my_first_block );
            __TBB_RETHROW();
        }
    }

template<typename T, class A>
template<class M >
tbb::concurrent_vector< T, A >::concurrent_vector ( const concurrent_vector< T, M > &  vector,
const allocator_type a = allocator_type() 
) [inline]

Definition at line 529 of file concurrent_vector.h.

        : internal::allocator_base<T, A>(a), internal::concurrent_vector_base()
    {
        vector_allocator_ptr = &internal_allocator;
        __TBB_TRY {
            internal_copy(vector.internal_vector_base(), sizeof(T), &copy_array);
        } __TBB_CATCH(...) {
            segment_t *table = my_segment;
            internal_free_segments( reinterpret_cast<void**>(table), internal_clear(&destroy_array), my_first_block );
            __TBB_RETHROW();
        }
    }

template<typename T, class A>
tbb::concurrent_vector< T, A >::concurrent_vector ( size_type  n  )  [inline, explicit]

Definition at line 543 of file concurrent_vector.h.

    {
        vector_allocator_ptr = &internal_allocator;
        __TBB_TRY {
            internal_resize( n, sizeof(T), max_size(), NULL, &destroy_array, &initialize_array );
        } __TBB_CATCH(...) {
            segment_t *table = my_segment;
            internal_free_segments( reinterpret_cast<void**>(table), internal_clear(&destroy_array), my_first_block );
            __TBB_RETHROW();
        }
    }

template<typename T, class A>
tbb::concurrent_vector< T, A >::concurrent_vector ( size_type  n,
const_reference  t,
const allocator_type a = allocator_type() 
) [inline]

Definition at line 556 of file concurrent_vector.h.

        : internal::allocator_base<T, A>(a)
    {
        vector_allocator_ptr = &internal_allocator;
        __TBB_TRY {
            internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(&t), &destroy_array, &initialize_array_by );
        } __TBB_CATCH(...) {
            segment_t *table = my_segment;
            internal_free_segments( reinterpret_cast<void**>(table), internal_clear(&destroy_array), my_first_block );
            __TBB_RETHROW();
        }
    }

template<typename T, class A>
template<class I >
tbb::concurrent_vector< T, A >::concurrent_vector ( first,
last,
const allocator_type a = allocator_type() 
) [inline]

Definition at line 571 of file concurrent_vector.h.

        : internal::allocator_base<T, A>(a)
    {
        vector_allocator_ptr = &internal_allocator;
        __TBB_TRY {
            internal_assign_range(first, last, static_cast<is_integer_tag<std::numeric_limits<I>::is_integer> *>(0) );
        } __TBB_CATCH(...) {
            segment_t *table = my_segment;
            internal_free_segments( reinterpret_cast<void**>(table), internal_clear(&destroy_array), my_first_block );
            __TBB_RETHROW();
        }
    }

template<typename T, class A>
tbb::concurrent_vector< T, A >::~concurrent_vector (  )  [inline]

Definition at line 823 of file concurrent_vector.h.

                         {
        segment_t *table = my_segment;
        internal_free_segments( reinterpret_cast<void**>(table), internal_clear(&destroy_array), my_first_block );
        // base class destructor call should be then
    }


Member Function Documentation

template<typename T, class A>
void tbb::concurrent_vector< T, A >::assign ( size_type  n,
const_reference  t 
) [inline]

Definition at line 797 of file concurrent_vector.h.

                                                {
        clear();
        internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(&t), &destroy_array, &initialize_array_by );
    }

template<typename T, class A>
template<class I >
void tbb::concurrent_vector< T, A >::assign ( first,
last 
) [inline]

Definition at line 804 of file concurrent_vector.h.

                                 {
        clear(); internal_assign_range( first, last, static_cast<is_integer_tag<std::numeric_limits<I>::is_integer> *>(0) );
    }

template<typename T, class A>
reference tbb::concurrent_vector< T, A >::at ( size_type  index  )  [inline]

Definition at line 683 of file concurrent_vector.h.

                                    {
        return internal_subscript_with_exceptions(index);
    }

template<typename T, class A>
const_reference tbb::concurrent_vector< T, A >::at ( size_type  index  )  const [inline]

Definition at line 688 of file concurrent_vector.h.

                                                {
        return internal_subscript_with_exceptions(index);
    }

template<typename T, class A>
reference tbb::concurrent_vector< T, A >::back (  )  [inline]

Definition at line 784 of file concurrent_vector.h.

                     {
        __TBB_ASSERT( size()>0, NULL);
        return internal_subscript( size()-1 );
    }

template<typename T, class A>
const_reference tbb::concurrent_vector< T, A >::back (  )  const [inline]

Definition at line 789 of file concurrent_vector.h.

                                 {
        __TBB_ASSERT( size()>0, NULL);
        return internal_subscript( size()-1 );
    }

template<typename T, class A>
iterator tbb::concurrent_vector< T, A >::begin (  )  [inline]

Definition at line 750 of file concurrent_vector.h.

Referenced by appendVector(), divide_and_conquer(), and tbb::operator==().

{return iterator(*this,0);}

template<typename T, class A>
const_iterator tbb::concurrent_vector< T, A >::begin (  )  const [inline]

Definition at line 754 of file concurrent_vector.h.

{return const_iterator(*this,0);}

template<typename T, class A>
size_type tbb::concurrent_vector< T, A >::capacity (  )  const [inline]

Definition at line 714 of file concurrent_vector.h.

{return internal_capacity();}

template<typename T, class A>
const_iterator tbb::concurrent_vector< T, A >::cbegin (  )  const [inline]

Definition at line 758 of file concurrent_vector.h.

{return const_iterator(*this,0);}

template<typename T, class A>
const_iterator tbb::concurrent_vector< T, A >::cend (  )  const [inline]

Definition at line 760 of file concurrent_vector.h.

{return const_iterator(*this,size());}

template<typename T, class A>
void tbb::concurrent_vector< T, A >::clear (  )  [inline]

To free up the memory, use in conjunction with method compact(). Not thread safe

Definition at line 818 of file concurrent_vector.h.

Referenced by initialize(), and quickhull().

                 {
        internal_clear(&destroy_array);
    }

template<typename T, class A>
const_reverse_iterator tbb::concurrent_vector< T, A >::crbegin (  )  const [inline]

Definition at line 770 of file concurrent_vector.h.

template<typename T, class A>
const_reverse_iterator tbb::concurrent_vector< T, A >::crend (  )  const [inline]

Definition at line 772 of file concurrent_vector.h.

template<typename T, class A>
bool tbb::concurrent_vector< T, A >::empty (  )  const [inline]

Definition at line 711 of file concurrent_vector.h.

{return !my_early_size;}

template<typename T, class A>
iterator tbb::concurrent_vector< T, A >::end (  )  [inline]

Definition at line 752 of file concurrent_vector.h.

Referenced by appendVector(), divide_and_conquer(), tbb::operator==(), and quickhull().

{return iterator(*this,size());}

template<typename T, class A>
const_iterator tbb::concurrent_vector< T, A >::end (  )  const [inline]

Definition at line 756 of file concurrent_vector.h.

{return const_iterator(*this,size());}

template<typename T, class A>
reference tbb::concurrent_vector< T, A >::front (  )  [inline]

Definition at line 774 of file concurrent_vector.h.

                      {
        __TBB_ASSERT( size()>0, NULL);
        return static_cast<T*>(my_segment[0].array)[0];
    }

template<typename T, class A>
const_reference tbb::concurrent_vector< T, A >::front (  )  const [inline]

Definition at line 779 of file concurrent_vector.h.

                                  {
        __TBB_ASSERT( size()>0, NULL);
        return static_cast<const T*>(my_segment[0].array)[0];
    }

template<typename T, class A>
allocator_type tbb::concurrent_vector< T, A >::get_allocator (  )  const [inline]

Definition at line 794 of file concurrent_vector.h.

{ return this->my_allocator; }

template<typename T, class A>
iterator tbb::concurrent_vector< T, A >::grow_by ( size_type  delta,
const_reference  t 
) [inline]

Returns iterator pointing to the first new element.

Definition at line 624 of file concurrent_vector.h.

                                                           {
        return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array_by, static_cast<const void*>(&t) ) : my_early_size);
    }

template<typename T, class A>
iterator tbb::concurrent_vector< T, A >::grow_by ( size_type  delta  )  [inline]

Returns iterator pointing to the first new element.

Definition at line 611 of file concurrent_vector.h.

Referenced by appendVector(), and SerialVectorFib().

                                        {
        return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array, NULL ) : my_early_size);
    }

template<typename T, class A>
iterator tbb::concurrent_vector< T, A >::grow_to_at_least ( size_type  n  )  [inline]

The new elements are default constructed. Blocks until all elements in range [0..n) are allocated. May return while other elements are being constructed by other threads. Returns iterator that points to beginning of appended sequence. If no elements were appended, returns iterator pointing to nth element.

Definition at line 641 of file concurrent_vector.h.

Referenced by SerialVectorFib().

                                             {
        size_type m=0;
        if( n ) {
            m = internal_grow_to_at_least_with_result( n, sizeof(T), &initialize_array, NULL );
            if( m>n ) m=n;
        }
        return iterator(*this, m);
    };

template<typename T, class A>
const internal::concurrent_vector_base_v3& tbb::concurrent_vector< T, A >::internal_vector_base (  )  const [inline]
template<typename T, class A>
size_type tbb::concurrent_vector< T, A >::max_size (  )  const [inline]

Definition at line 743 of file concurrent_vector.h.

{return (~size_type(0))/sizeof(T);}

template<typename T, class A>
template<class M >
concurrent_vector& tbb::concurrent_vector< T, A >::operator= ( const concurrent_vector< T, M > &  vector  )  [inline]

Definition at line 593 of file concurrent_vector.h.

                                                                          {
        if( static_cast<void*>( this ) != static_cast<const void*>( &vector ) )
            internal_assign(vector.internal_vector_base(),
                sizeof(T), &destroy_array, &assign_array, &copy_array);
        return *this;
    }

template<typename T, class A>
concurrent_vector& tbb::concurrent_vector< T, A >::operator= ( const concurrent_vector< T, A > &  vector  )  [inline]

Definition at line 585 of file concurrent_vector.h.

                                                                    {
        if( this != &vector )
            internal_assign(vector, sizeof(T), &destroy_array, &assign_array, &copy_array);
        return *this;
    }

template<typename T, class A>
reference tbb::concurrent_vector< T, A >::operator[] ( size_type  index  )  [inline]

This method is thread-safe for concurrent reads, and also while growing the vector, as long as the calling thread has checked that index<size().

Definition at line 673 of file concurrent_vector.h.

                                            {
        return internal_subscript(index);
    }

template<typename T, class A>
const_reference tbb::concurrent_vector< T, A >::operator[] ( size_type  index  )  const [inline]

Definition at line 678 of file concurrent_vector.h.

                                                        {
        return internal_subscript(index);
    }

template<typename T, class A>
iterator tbb::concurrent_vector< T, A >::push_back ( const_reference  item  )  [inline]

Returns iterator pointing to the new element.

Definition at line 656 of file concurrent_vector.h.

Referenced by divide_and_conquer(), SplitByCP::operator()(), and FillRNDPointsVector::operator()().

    {
        size_type k;
        void *ptr = internal_push_back(sizeof(T),k);
        internal_loop_guide loop(1, ptr);
        loop.init(&item);
#if TBB_DEPRECATED
        return k;
#else
        return iterator(*this, k, ptr);
#endif
    }

template<typename T, class A>
range_type tbb::concurrent_vector< T, A >::range ( size_t  grainsize = 1  )  [inline]

Definition at line 693 of file concurrent_vector.h.

                                            {
        return range_type( begin(), end(), grainsize );
    }

template<typename T, class A>
const_range_type tbb::concurrent_vector< T, A >::range ( size_t  grainsize = 1  )  const [inline]

Definition at line 698 of file concurrent_vector.h.

                                                         {
        return const_range_type( begin(), end(), grainsize );
    }

template<typename T, class A>
reverse_iterator tbb::concurrent_vector< T, A >::rbegin (  )  [inline]

Definition at line 762 of file concurrent_vector.h.

{return reverse_iterator(end());}

template<typename T, class A>
const_reverse_iterator tbb::concurrent_vector< T, A >::rbegin (  )  const [inline]

Definition at line 766 of file concurrent_vector.h.

template<typename T, class A>
reverse_iterator tbb::concurrent_vector< T, A >::rend (  )  [inline]

Definition at line 764 of file concurrent_vector.h.

{return reverse_iterator(begin());}

template<typename T, class A>
const_reverse_iterator tbb::concurrent_vector< T, A >::rend (  )  const [inline]

Definition at line 768 of file concurrent_vector.h.

template<typename T, class A>
void tbb::concurrent_vector< T, A >::reserve ( size_type  n  )  [inline]

Like most of the methods provided for STL compatibility, this method is *not* thread safe. The capacity afterwards may be bigger than the requested reservation.

Definition at line 719 of file concurrent_vector.h.

                                {
        if( n )
            internal_reserve(n, sizeof(T), max_size());
    }

template<typename T, class A>
void tbb::concurrent_vector< T, A >::resize ( size_type  n,
const_reference  t 
) [inline]

Definition at line 730 of file concurrent_vector.h.

                                                  {
        internal_resize( n, sizeof(T), max_size(), static_cast<const void*>(&t), &destroy_array, &initialize_array_by );
    }

template<typename T, class A>
void tbb::concurrent_vector< T, A >::resize ( size_type  n  )  [inline]

Definition at line 725 of file concurrent_vector.h.

                               {
        internal_resize( n, sizeof(T), max_size(), NULL, &destroy_array, &initialize_array );
    }

template<typename T , class A >
void tbb::concurrent_vector< T, A >::shrink_to_fit (  ) 

Definition at line 902 of file concurrent_vector.h.

References T.

                                            {
    internal_segments_table old;
    __TBB_TRY {
        if( internal_compact( sizeof(T), &old, &destroy_array, &copy_array ) )
            internal_free_segments( old.table, pointers_per_long_table, old.first_block ); // free joined and unnecessary segments
    } __TBB_CATCH(...) {
        if( old.first_block ) // free segment allocated for compacting. Only for support of exceptions in ctor of user T[ype]
            internal_free_segments( old.table, 1, old.first_block );
        __TBB_RETHROW();
    }
}

template<typename T, class A>
size_type tbb::concurrent_vector< T, A >::size (  )  const [inline]

Definition at line 705 of file concurrent_vector.h.

Referenced by appendVector(), divide(), divide_and_conquer(), extremum(), and tbb::operator==().

                           {
        size_type sz = my_early_size, cp = internal_capacity();
        return cp < sz ? cp : sz;
    }

template<typename T, class A>
void tbb::concurrent_vector< T, A >::swap ( concurrent_vector< T, A > &  vector  )  [inline]

Definition at line 809 of file concurrent_vector.h.

Referenced by tbb::swap().

                                         {
        if( this != &vector ) {
            concurrent_vector_base_v3::internal_swap(static_cast<concurrent_vector_base_v3&>(vector));
            std::swap(this->my_allocator, vector.my_allocator);
        }
    }


Friends And Related Function Documentation

template<typename T, class A>
friend class internal::vector_iterator [friend]

Definition at line 468 of file concurrent_vector.h.


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

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

Licensed under the GNU General Public License 2 with the runtime exception.

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.