ATLAS Offline Software
Public Types | Static Public Attributes | List of all members
ConstDataVector< DV > Class Template Reference

DataVector adapter that acts like it holds const pointers. More...

#include <ConstDataVector.h>

Inheritance diagram for ConstDataVector< DV >:
Collaboration diagram for ConstDataVector< DV >:

Public Types

typedef DV::size_type size_type
 Basic types, forwarded from the base. More...
 
typedef DV::difference_type difference_type
 
typedef DV::allocator_type allocator_type
 
typedef DV::base_value_type base_value_type
 
typedef DV::BaseContainer BaseContainer
 
typedef DV::DVL_BASE DVL_BASE
 
typedef DV::const_iterator const_iterator
 
typedef DV::const_reverse_iterator const_reverse_iterator
 
typedef DataVector< base_value_typebase_data_vector
 
typedef DV::const_value_type value_type
 These types get modified so that the base's const_value_type becomes our value_type. More...
 
typedef DV::const_value_type const_value_type
 
typedef DV::const_value_type & reference
 
typedef DV::const_value_type constconst_reference
 
typedef DV::const_value_type * pointer
 
typedef DV::const_value_type constconst_pointer
 
typedef std::unique_ptr< const base_value_typeunique_type
 Type of a unique_ptr that can be used to insert elements into this container. More...
 
typedef DataModel_detail::ElementProxy< ConstDataVectorElementProxy
 This type is used to proxy lvalue accesses to DataVector elements, in order to handle ownership. More...
 
typedef DataModel_detail::iterator< ConstDataVectoriterator
 The iterator for this type. More...
 
typedef std::reverse_iterator< iteratorreverse_iterator
 Standard reverse_iterator. More...
 
typedef boost::true_type isSequence
 

Public Member Functions

Constructors, destructors, assignment.
 ConstDataVector (SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS)
 Default constructor. More...
 
template<typename... ARGS>
 ConstDataVector (SG::OwnershipPolicy ownPolicy, ARGS &&... args)
 Constructor with argument forwarding. More...
 
 ConstDataVector (size_type n, SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS)
 Sized constructor. More...
 
template<class InputIterator >
 ConstDataVector (InputIterator first, InputIterator last, SG::OwnershipPolicy ownPolicy=SG::VIEW_ELEMENTS)
 Constructor from iterators. More...
 
 ConstDataVector (const ConstDataVector &)=default
 Copy constructor. More...
 
 ConstDataVector (ConstDataVector &&rhs)
 Move constructor. More...
 
 ConstDataVector (std::initializer_list< value_type > l, SG::OwnershipPolicy ownPolicy=SG::VIEW_ELEMENTS)
 Constructor from an initializer list. More...
 
template<class CONTAINER >
 ConstDataVector (const std::vector< ElementLink< CONTAINER > > &v)
 Constructor from a vector of ElementLinks. More...
 
ConstDataVectoroperator= (const ConstDataVector &rhs)
 Assignment operator. More...
 
ConstDataVectoroperator= (ConstDataVector &&rhs)
 Move assignment. More...
 
ConstDataVectoroperator= (std::initializer_list< value_type > l)
 Assignment operator, from an initializer list. More...
 
template<class InputIterator >
void assign (InputIterator first, InputIterator last)
 Assign from iterators. More...
 
void assign (std::initializer_list< value_type > l)
 Assign from an initializer list. More...
 
template<class CONTAINER >
void assign (const std::vector< ElementLink< CONTAINER > > &v)
 Assign from a vector of ElementLinks. More...
 
Element access.
ElementProxy operator[] (size_type n)
 Access an element, as an lvalue. More...
 
ElementProxy at (size_type n)
 Access an element, as an lvalue. More...
 
ElementProxy front ()
 Access the first element in the collection as an lvalue. More...
 
ElementProxy back ()
 Access the last element in the collection as an lvalue. More...
 
Iterator creation.
iterator begin () noexcept
 Return an iterator pointing at the beginning of the collection. More...
 
iterator end () noexcept
 Return an iterator pointing past the end of the collection. More...
 
reverse_iterator rbegin () noexcept
 Return a reverse_iterator pointing past the end of the collection. More...
 
reverse_iterator rend () noexcept
 Return a reverse_iterator pointing at the beginning of the collection. More...
 
Insertion operations.
value_type push_back (value_type pElem)
 Add an element to the end of the collection. More...
 
value_type emplace_back (value_type pElem)
 Add an element to the end of the collection. More...
 
iterator insert (iterator position, value_type pElem)
 Add a new element to the collection. More...
 
iterator emplace (iterator position, value_type pElem)
 Add a new element to the collection. More...
 
template<class InputIterator >
void insert (iterator position, InputIterator first, InputIterator last)
 Add a group of new elements to the collection. More...
 
value_type push_back (std::unique_ptr< const base_value_type > pElem)
 Add an element to the end of the collection. More...
 
iterator insert (iterator position, std::unique_ptr< const base_value_type > pElem)
 Add a new element to the collection. More...
 
void insert (iterator position, std::initializer_list< value_type > l)
 Add a group of new elements to the collection. More...
 
Erasure operations.
iterator erase (iterator position)
 Remove element at a given position. More...
 
iterator erase (iterator first, iterator last)
 Remove a range of elements. More...
 
void clear ()
 Erase all the elements in the collection. More...
 
Relational operators.
bool operator< (const ConstDataVector &b) const
 Vector ordering relation. More...
 
bool operator> (const ConstDataVector &b) const
 Based on operator<. More...
 
bool operator<= (const ConstDataVector &b) const
 Based on operator<. More...
 
bool operator>= (const ConstDataVector &b) const
 Based on operator<. More...
 
bool operator== (const ConstDataVector &b) const
 Vector equality comparison. More...
 
bool operator!= (const ConstDataVector &b) const
 Based on operator==. More...
 

Static Public Attributes

static const bool has_virtual = DV::has_virtual
 This needs to be forwarded from the base as well. More...
 
static constexpr bool must_own = DV::must_own
 If true, then this type must own its contents. More...
 

Swap and sort.

void swap (ConstDataVector &rhs)
 Swap this collection with another. More...
 
static void iter_swap (iterator a, iterator b)
 Swap the referents of two DataVector iterators. More...
 

Non-standard operations.

void swapElement (size_type index, value_type newElem, reference oldElem)
 Swap one element out of the container. More...
 
void swapElement (iterator pos, value_type newElem, reference oldElem)
 Swap one element out of the container. More...
 
void swapElement (size_type index, std::unique_ptr< const base_value_type > newElem, std::unique_ptr< const base_value_type > &oldElem)
 Swap one element out of the container. More...
 
void swapElement (iterator pos, std::unique_ptr< const base_value_type > newElem, std::unique_ptr< const base_value_type > &oldElem)
 Swap one element out of the container. More...
 
const DV * asDataVector () const
 Return a pointer to this object, as a const DataVector. More...
 
void resortAux (iterator, iterator)
 Reset indices / reorder aux data after elements have been permuted. More...
 
void clear (SG::OwnershipPolicy ownPolicy)
 Erase all the elements in the collection, and reset the ownership mode. More...
 
void clear (SG::OwnershipPolicy ownPolicy, SG::IndexTrackingPolicy trackIndices)
 
const SG::AuxVectorBaseauxbase () const
 Convert to AuxVectorBase. More...
 
static const ConstDataVectorfromDataVector (const DV *dv)
 Cast from a DataVector to a ConstDataVector. More...
 

Private helpers.

class DataModel_detail::ElementProxy< ConstDataVector >
 
void test2_assignelement1 ()
 
void test2_assignelement1a ()
 
void assignElement (typename BaseContainer::iterator pos, value_type newElem)
 Handle element assignment. More...
 
void assignElement (typename BaseContainer::iterator pos, std::unique_ptr< const base_value_type > newElem)
 Handle element assignment. More...
 
void assignBaseElement (typename BaseContainer::iterator pos, typename BaseContainer::value_type newElem)
 Handle element assignment from a base pointer. More...
 
iterator to_my_iterator (typename DV::iterator it)
 Convert an iterator of the base DataVector to a ConstDataVector::iterator. More...
 
ElementProxy to_element_proxy (typename BaseContainer::iterator i)
 Convert an iterator of the base vector to an ElementProxy for the ConstDataVector. More...
 
static DV::iterator to_base_iterator (iterator it)
 Convert a ConstDataVector::iterator to an iterator of the base DataVector. More...
 

Detailed Description

template<class DV>
class ConstDataVector< DV >

DataVector adapter that acts like it holds const pointers.

Definition at line 74 of file ConstDataVector.h.

Member Typedef Documentation

◆ allocator_type

template<class DV >
typedef DV::allocator_type ConstDataVector< DV >::allocator_type

Definition at line 81 of file ConstDataVector.h.

◆ base_data_vector

template<class DV >
typedef DataVector<base_value_type> ConstDataVector< DV >::base_data_vector

Definition at line 89 of file ConstDataVector.h.

◆ base_value_type

template<class DV >
typedef DV::base_value_type ConstDataVector< DV >::base_value_type

Definition at line 82 of file ConstDataVector.h.

◆ BaseContainer

template<class DV >
typedef DV::BaseContainer ConstDataVector< DV >::BaseContainer

Definition at line 83 of file ConstDataVector.h.

◆ const_iterator

template<class DV >
typedef DV::const_iterator ConstDataVector< DV >::const_iterator

Definition at line 85 of file ConstDataVector.h.

◆ const_pointer

template<class DV >
typedef DV::const_value_type const* ConstDataVector< DV >::const_pointer

Definition at line 98 of file ConstDataVector.h.

◆ const_reference

template<class DV >
typedef DV::const_value_type const& ConstDataVector< DV >::const_reference

Definition at line 96 of file ConstDataVector.h.

◆ const_reverse_iterator

template<class DV >
typedef DV::const_reverse_iterator ConstDataVector< DV >::const_reverse_iterator

Definition at line 86 of file ConstDataVector.h.

◆ const_value_type

template<class DV >
typedef DV::const_value_type ConstDataVector< DV >::const_value_type

Definition at line 94 of file ConstDataVector.h.

◆ difference_type

template<class DV >
typedef DV::difference_type ConstDataVector< DV >::difference_type

Definition at line 80 of file ConstDataVector.h.

◆ DVL_BASE

template<class DV >
typedef DV::DVL_BASE ConstDataVector< DV >::DVL_BASE

Definition at line 84 of file ConstDataVector.h.

◆ ElementProxy

This type is used to proxy lvalue accesses to DataVector elements, in order to handle ownership.

Definition at line 110 of file ConstDataVector.h.

◆ isSequence

template<class DV >
typedef boost::true_type ConstDataVector< DV >::isSequence

Definition at line 120 of file ConstDataVector.h.

◆ iterator

The iterator for this type.

Definition at line 113 of file ConstDataVector.h.

◆ pointer

template<class DV >
typedef DV::const_value_type* ConstDataVector< DV >::pointer

Definition at line 97 of file ConstDataVector.h.

◆ reference

template<class DV >
typedef DV::const_value_type& ConstDataVector< DV >::reference

Definition at line 95 of file ConstDataVector.h.

◆ reverse_iterator

template<class DV >
typedef std::reverse_iterator<iterator> ConstDataVector< DV >::reverse_iterator

Standard reverse_iterator.

Note that lvalue references here will yield an ElementProxy, not a reference.

Definition at line 118 of file ConstDataVector.h.

◆ size_type

template<class DV >
typedef DV::size_type ConstDataVector< DV >::size_type

Basic types, forwarded from the base.

Definition at line 79 of file ConstDataVector.h.

◆ unique_type

template<class DV >
typedef std::unique_ptr<const base_value_type> ConstDataVector< DV >::unique_type

Type of a unique_ptr that can be used to insert elements into this container.

Definition at line 106 of file ConstDataVector.h.

◆ value_type

template<class DV >
typedef DV::const_value_type ConstDataVector< DV >::value_type

These types get modified so that the base's const_value_type becomes our value_type.

Definition at line 93 of file ConstDataVector.h.

Constructor & Destructor Documentation

◆ ConstDataVector() [1/8]

template<class DV >
ConstDataVector< DV >::ConstDataVector ( SG::OwnershipPolicy  ownPolicy = SG::OWN_ELEMENTS)
explicit

Default constructor.

Parameters
ownPolicyThe ownership mode for the container.

By default, a DataVector will own its elements. To avoid this, pass SG::VIEW_ELEMENTS for ownPolicy.

◆ ConstDataVector() [2/8]

template<class DV >
template<typename... ARGS>
ConstDataVector< DV >::ConstDataVector ( SG::OwnershipPolicy  ownPolicy,
ARGS &&...  args 
)
explicit

Constructor with argument forwarding.

Parameters
ownPolicyThe ownership mode for the container.

All arguments are forwarded to the base class constructor.

◆ ConstDataVector() [3/8]

template<class DV >
ConstDataVector< DV >::ConstDataVector ( size_type  n,
SG::OwnershipPolicy  ownPolicy = SG::OWN_ELEMENTS 
)
explicit

Sized constructor.

Parameters
nThe size of the container.
ownPolicyThe ownership mode for the container.

Note that unlike the standard vector constructor, you can't specify an initial value here. The container will be initialized with 0's.

By default, a DataVector will own its elements. To avoid this, pass SG::VIEW_ELEMENTS for ownPolicy.

◆ ConstDataVector() [4/8]

template<class DV >
template<class InputIterator >
ConstDataVector< DV >::ConstDataVector ( InputIterator  first,
InputIterator  last,
SG::OwnershipPolicy  ownPolicy = SG::VIEW_ELEMENTS 
)

Constructor from iterators.

Parameters
firstThe start of the range to put in the new container.
lastThe end of the range to put in the new container.
ownPolicyThe ownership mode for the container.

By default, a view container is made, which does not own its elements. To have the container take ownership of the pointers passed to this constructor, pass SG::OWN_ELEMENTS for ownPolicy.

◆ ConstDataVector() [5/8]

template<class DV >
ConstDataVector< DV >::ConstDataVector ( const ConstDataVector< DV > &  )
default

Copy constructor.

Parameters
rhsThe container from which to copy.

This is a ‘shallow’ copy; the new container will not own its elements.

◆ ConstDataVector() [6/8]

template<class DV >
ConstDataVector< DV >::ConstDataVector ( ConstDataVector< DV > &&  rhs)

Move constructor.

Parameters
rhsThe container from which to move.

Any auxiliary data will be moved along with the container contents.

◆ ConstDataVector() [7/8]

template<class DV >
ConstDataVector< DV >::ConstDataVector ( std::initializer_list< value_type l,
SG::OwnershipPolicy  ownPolicy = SG::VIEW_ELEMENTS 
)

Constructor from an initializer list.

Parameters
lAn initializer list.
ownPolicyThe ownership mode for the container.

By default, a view container is made, which does not own its elements. To have the container take ownership of the pointers passed to this constructor, pass SG::OWN_ELEMENTS for ownPolicy.

◆ ConstDataVector() [8/8]

template<class DV >
template<class CONTAINER >
ConstDataVector< DV >::ConstDataVector ( const std::vector< ElementLink< CONTAINER > > &  v)

Constructor from a vector of ElementLinks.

Parameters
vThe vector from which to initialize.

This will make a view container.

Member Function Documentation

◆ asDataVector()

template<class DV >
const DV* ConstDataVector< DV >::asDataVector ( ) const

Return a pointer to this object, as a const DataVector.

◆ assign() [1/3]

template<class DV >
template<class CONTAINER >
void ConstDataVector< DV >::assign ( const std::vector< ElementLink< CONTAINER > > &  v)

Assign from a vector of ElementLinks.

Parameters
vThe vector from which to initialize.

This will change the container to a view container.

◆ assign() [2/3]

template<class DV >
template<class InputIterator >
void ConstDataVector< DV >::assign ( InputIterator  first,
InputIterator  last 
)

Assign from iterators.

Parameters
firstThe start of the range to put in the container.
lastThe end of the range to put in the container.

Any existing owned elements will be released. The DataVector's ownership policy determines whether it will take ownership of the new elements.

◆ assign() [3/3]

template<class DV >
void ConstDataVector< DV >::assign ( std::initializer_list< value_type l)

Assign from an initializer list.

Parameters
lAn initializer list.

Any existing owned elements will be released. The DataVector's ownership policy determines whether it will take ownership of the new elements.

◆ assignBaseElement()

template<class DV >
void ConstDataVector< DV >::assignBaseElement ( typename BaseContainer::iterator  pos,
typename BaseContainer::value_type  newElem 
)
private

Handle element assignment from a base pointer.

Parameters
posPosition in the container to assign.
newElemThe new element to assign.

The old element is freed if this container owns elements. Auxiliary data are copied if appropriate.

◆ assignElement() [1/2]

template<class DV >
void ConstDataVector< DV >::assignElement ( typename BaseContainer::iterator  pos,
std::unique_ptr< const base_value_type newElem 
)
private

Handle element assignment.

Parameters
posPosition in the container to assign.
newElemThe new element to assign.

The container must own its elements. Auxiliary data are copied if appropriate.

◆ assignElement() [2/2]

template<class DV >
void ConstDataVector< DV >::assignElement ( typename BaseContainer::iterator  pos,
value_type  newElem 
)
private

Handle element assignment.

Parameters
posPosition in the container to assign.
newElemThe new element to assign.

The old element is freed if this container owns elements. Auxiliary data are copied if appropriate.

◆ at()

template<class DV >
ElementProxy ConstDataVector< DV >::at ( size_type  n)

Access an element, as an lvalue.

Parameters
nArray index to access.
Returns
Proxy to the element at n.

Will raise std::out_of_range if the index is out-of-bounds. Note that we return a proxy object rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ auxbase()

template<class DV >
const SG::AuxVectorBase& ConstDataVector< DV >::auxbase ( ) const

Convert to AuxVectorBase.

Needed to get @x AuxVectorBase from a ConstDataVector. Present in DataVector as well for consistency.

◆ back()

template<class DV >
ElementProxy ConstDataVector< DV >::back ( )

Access the last element in the collection as an lvalue.

Returns
Proxy to the last element in the collection.

No checking is done to ensure that the container is not empty. Note that we return a proxy object rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ begin()

template<class DV >
iterator ConstDataVector< DV >::begin ( )
noexcept

Return an iterator pointing at the beginning of the collection.

Returns
An iterator.

Note that dereferencing the iterator will yield a proxy rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ clear() [1/3]

template<class DV >
void ConstDataVector< DV >::clear ( )

Erase all the elements in the collection.

Erase all the elements in the collection, and reset the ownership mode.

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this.

Parameters
ownPolicyThe new ownership policy of the container.
trackIndicesThe index tracking policy.

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this.

◆ clear() [2/3]

template<class DV >
void ConstDataVector< DV >::clear ( SG::OwnershipPolicy  ownPolicy)

Erase all the elements in the collection, and reset the ownership mode.

Parameters
ownPolicyThe new ownership policy of the container.

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this.

◆ clear() [3/3]

template<class DV >
void ConstDataVector< DV >::clear ( SG::OwnershipPolicy  ownPolicy,
SG::IndexTrackingPolicy  trackIndices 
)

◆ emplace()

template<class DV >
iterator ConstDataVector< DV >::emplace ( iterator  position,
value_type  pElem 
)

Add a new element to the collection.

Parameters
positionIterator before which the element will be added.
pElemThe element to add to the collection.
Returns
An iterator that points to the inserted data.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

For DataVector, this is just the same as insert. It's included just for interface compatibility with std::vector.

◆ emplace_back()

template<class DV >
value_type ConstDataVector< DV >::emplace_back ( value_type  pElem)

Add an element to the end of the collection.

Parameters
pElemThe element to add to the collection.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

For DataVector, this is like the same as push_back, and it returns the pushed element. It's included just for interface compatibility with std::vector.

◆ end()

template<class DV >
iterator ConstDataVector< DV >::end ( )
noexcept

Return an iterator pointing past the end of the collection.

Returns
An iterator.

Note that dereferencing the iterator will yield a proxy rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ erase() [1/2]

template<class DV >
iterator ConstDataVector< DV >::erase ( iterator  first,
iterator  last 
)

Remove a range of elements.

Parameters
firstIterator pointing to the first element to be removed.
lastIterator pointing one past the last element to be removed.
Returns
An iterator pointing to the element pointed to by last prior to erasing (or end()).

If the container owns its elements, then the removed elements will be deleted. Any duplicates will be removed in this process, but don't rely on this.

◆ erase() [2/2]

template<class DV >
iterator ConstDataVector< DV >::erase ( iterator  position)

Remove element at a given position.

Parameters
positionIterator pointing to the element to be removed.
Returns
An iterator pointing to the next element (or end()).

If the container owns its elements, then the pointed-to element will be deleted.

◆ fromDataVector()

template<class DV >
static const ConstDataVector* ConstDataVector< DV >::fromDataVector ( const DV *  dv)
static

Cast from a DataVector to a ConstDataVector.

Parameters
dvPointer to object to cast.

Return DV cast to a ConstDataVector.

◆ front()

template<class DV >
ElementProxy ConstDataVector< DV >::front ( )

Access the first element in the collection as an lvalue.

Returns
Proxy to the first element in the collection.

No checking is done to ensure that the container is not empty. Note that we return a proxy object rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ insert() [1/4]

template<class DV >
template<class InputIterator >
void ConstDataVector< DV >::insert ( iterator  position,
InputIterator  first,
InputIterator  last 
)

Add a group of new elements to the collection.

Parameters
positionIterator before which the element will be added.
firstThe start of the range to put in the container.
lastThe end of the range to put in the container.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ insert() [2/4]

template<class DV >
void ConstDataVector< DV >::insert ( iterator  position,
std::initializer_list< value_type l 
)

Add a group of new elements to the collection.

Parameters
positionIterator before which the element will be added.
lAn initializer list.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ insert() [3/4]

template<class DV >
iterator ConstDataVector< DV >::insert ( iterator  position,
std::unique_ptr< const base_value_type pElem 
)

Add a new element to the collection.

Parameters
positionIterator before which the element will be added.
pElemThe element to add to the collection.
Returns
An iterator that points to the inserted data.

The container must be an owning container.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ insert() [4/4]

template<class DV >
iterator ConstDataVector< DV >::insert ( iterator  position,
value_type  pElem 
)

Add a new element to the collection.

Parameters
positionIterator before which the element will be added.
pElemThe element to add to the collection.
Returns
An iterator that points to the inserted data.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ iter_swap()

template<class DV >
static void ConstDataVector< DV >::iter_swap ( iterator  a,
iterator  b 
)
static

Swap the referents of two DataVector iterators.

Parameters
aThe first iterator for the swap.
bThe second iterator for the swap.

◆ operator!=()

template<class DV >
bool ConstDataVector< DV >::operator!= ( const ConstDataVector< DV > &  b) const

Based on operator==.

◆ operator<()

template<class DV >
bool ConstDataVector< DV >::operator< ( const ConstDataVector< DV > &  b) const

Vector ordering relation.

Parameters
bA ConstDataVector of the same type as *this.
Returns
True iff *this is lexicographically less than b.

This is a total ordering relation. It is linear in the size of the vectors. Comparisons are done on the pointer values of the elements.

See std::lexicographical_compare() for how the determination is made.

◆ operator<=()

template<class DV >
bool ConstDataVector< DV >::operator<= ( const ConstDataVector< DV > &  b) const

Based on operator<.

◆ operator=() [1/3]

template<class DV >
ConstDataVector& ConstDataVector< DV >::operator= ( const ConstDataVector< DV > &  rhs)

Assignment operator.

Parameters
rhsThe DataVector from which to assign.
Returns
This object.

This is a ‘shallow’ copy; after the completion of this, the DataVector will not own its elements. Any elements it owned prior to this call will be released.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ operator=() [2/3]

template<class DV >
ConstDataVector& ConstDataVector< DV >::operator= ( ConstDataVector< DV > &&  rhs)

Move assignment.

Parameters
rhsThe container from which to move.

Any auxiliary data will be moved along with the container contents.

◆ operator=() [3/3]

template<class DV >
ConstDataVector& ConstDataVector< DV >::operator= ( std::initializer_list< value_type l)

Assignment operator, from an initializer list.

Parameters
lAn initializer list.
Returns
This object.

This is equivalent to assign. Any existing owned elements will be released. The DataVector's ownership policy determines whether it will take ownership of the new elements.

◆ operator==()

template<class DV >
bool ConstDataVector< DV >::operator== ( const ConstDataVector< DV > &  b) const

Vector equality comparison.

Parameters
bA ConstDataVector of the same type as *this.
Returns
True iff the size and elements of the vectors are equal.

This is an equivalence relation. It is linear in the size of the vectors. Vectors are considered equivalent if their sizes are equal, and if corresponding elements compare equal.

◆ operator>()

template<class DV >
bool ConstDataVector< DV >::operator> ( const ConstDataVector< DV > &  b) const

Based on operator<.

◆ operator>=()

template<class DV >
bool ConstDataVector< DV >::operator>= ( const ConstDataVector< DV > &  b) const

Based on operator<.

◆ operator[]()

template<class DV >
ElementProxy ConstDataVector< DV >::operator[] ( size_type  n)

Access an element, as an lvalue.

Parameters
nArray index to access.
Returns
Proxy to the element at n.

No bounds checking is done. Note that we return a proxy object rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ push_back() [1/2]

template<class DV >
value_type ConstDataVector< DV >::push_back ( std::unique_ptr< const base_value_type pElem)

Add an element to the end of the collection.

Parameters
pElemThe element to add to the collection.

The container must be an owning container.

Note: this method may only be called using the most derived DataVector in the hierarchy.

Returns the pushed pointer.

◆ push_back() [2/2]

template<class DV >
value_type ConstDataVector< DV >::push_back ( value_type  pElem)

Add an element to the end of the collection.

Parameters
pElemThe element to add to the collection.

The container's ownership policy will determine if it takes ownership of the new element.

Note: this method may only be called using the most derived DataVector in the hierarchy.

Returns the pushed pointer.

◆ rbegin()

template<class DV >
reverse_iterator ConstDataVector< DV >::rbegin ( )
noexcept

Return a reverse_iterator pointing past the end of the collection.

Returns
A reverse_iterator.

Note that dereferencing the iterator will yield a proxy rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ rend()

template<class DV >
reverse_iterator ConstDataVector< DV >::rend ( )
noexcept

Return a reverse_iterator pointing at the beginning of the collection.

Returns
A reverse_iterator.

Note that dereferencing the iterator will yield a proxy rather than a reference; the proxy will handle deleting an owned element if it's assigned to.

◆ resortAux()

template<class DV >
void ConstDataVector< DV >::resortAux ( iterator  ,
iterator   
)

Reset indices / reorder aux data after elements have been permuted.

Parameters
begStart of the range of elements to process.
endEnd of the range of elements to process.

This is a no-op for ConstDataVector.

◆ swap()

template<class DV >
void ConstDataVector< DV >::swap ( ConstDataVector< DV > &  rhs)

Swap this collection with another.

Parameters
rhsThe collection with which to swap.

Ownership is swapped along with the collection content.

Note: this method may only be called using the most-derived DataVector in the hierarchy. The rhs must also be referenced using the most-derived DataVector.

◆ swapElement() [1/4]

template<class DV >
void ConstDataVector< DV >::swapElement ( iterator  pos,
std::unique_ptr< const base_value_type newElem,
std::unique_ptr< const base_value_type > &  oldElem 
)

Swap one element out of the container.

Parameters
posThe element in the container to swap.
newElemNew element to put in the container. May be 0.
oldElemReference to receive the element removed from the container.

Reference oldElem is initialized with element pos of the collection (no bounds checking). Then element index is set to newElem.

The collection must own its elements to use its interface. The collection will take ownership of newElem and will return ownership of oldElem.

Note: this method may only be called using the most derived DataList in the hierarchy.

◆ swapElement() [2/4]

template<class DV >
void ConstDataVector< DV >::swapElement ( iterator  pos,
value_type  newElem,
reference  oldElem 
)

Swap one element out of the container.

Parameters
posThe element in the container to swap.
newElemNew element to put in the container. May be 0.
oldElemReference to receive the element removed from the container.

Reference oldElem is initialized with element pos of the collection (no bounds checking). Then element index is set to newElem. If the collection owns its elements, then it will take ownership of newElem and release (without deleting) the element returned through oldElem.

Note: this method may only be called using the most derived DataList in the hierarchy.

◆ swapElement() [3/4]

template<class DV >
void ConstDataVector< DV >::swapElement ( size_type  index,
std::unique_ptr< const base_value_type newElem,
std::unique_ptr< const base_value_type > &  oldElem 
)

Swap one element out of the container.

Parameters
indexIndex of the element in the container to swap.
newElemNew element to put in the container. May be 0.
oldElemReference to receive the element removed from the container.

Reference oldElem is initialized with element index of the collection (no bounds checking). Then element index is set to newElem.

The collection must own its elements to use its interface. The collection will take ownership of newElem and will return ownership of oldElem.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ swapElement() [4/4]

template<class DV >
void ConstDataVector< DV >::swapElement ( size_type  index,
value_type  newElem,
reference  oldElem 
)

Swap one element out of the container.

Parameters
indexIndex of the element in the container to swap.
newElemNew element to put in the container. May be 0.
oldElemReference to receive the element removed from the container.

Reference oldElem is initialized with element index of the collection (no bounds checking). Then element index is set to newElem. If the collection owns its elements, then it will take ownership of newElem and release (without deleting) the element returned through oldElem.

Note: this method may only be called using the most derived DataVector in the hierarchy.

◆ to_base_iterator()

template<class DV >
static DV::iterator ConstDataVector< DV >::to_base_iterator ( iterator  it)
staticprivate

Convert a ConstDataVector::iterator to an iterator of the base DataVector.

Parameters
itThe ConstDataVector::iterator to convert.

◆ to_element_proxy()

template<class DV >
ElementProxy ConstDataVector< DV >::to_element_proxy ( typename BaseContainer::iterator  i)
private

Convert an iterator of the base vector to an ElementProxy for the ConstDataVector.

Parameters
itThe base vector iterator to convert.

◆ to_my_iterator()

template<class DV >
iterator ConstDataVector< DV >::to_my_iterator ( typename DV::iterator  it)
private

Convert an iterator of the base DataVector to a ConstDataVector::iterator.

Parameters
itThe base DataVector iterator to convert.

Friends And Related Function Documentation

◆ DataModel_detail::ElementProxy< ConstDataVector >

template<class DV >
friend class DataModel_detail::ElementProxy< ConstDataVector >
friend

Definition at line 844 of file ConstDataVector.h.

◆ test2_assignelement1

template<class DV >
void test2_assignelement1 ( )
friend

◆ test2_assignelement1a

template<class DV >
void test2_assignelement1a ( )
friend

Member Data Documentation

◆ has_virtual

template<class DV >
const bool ConstDataVector< DV >::has_virtual = DV::has_virtual
static

This needs to be forwarded from the base as well.

Definition at line 102 of file ConstDataVector.h.

◆ must_own

template<class DV >
constexpr bool ConstDataVector< DV >::must_own = DV::must_own
staticconstexpr

If true, then this type must own its contents.

Definition at line 124 of file ConstDataVector.h.


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