Loading...
Searching...
No Matches
aocommon::UVector< Tp, Alloc > Class Template Reference
Class UVector and related functions.

A container similar to std::vector, but one that allows construction without initializing its elements. More...

`#include <uvector.h>`

## Public Types

typedef Tp | value_type
| Element type.
typedef Alloc | allocator_type
| Type of allocator used to allocate and deallocate space.
typedef Tp & | reference
| Reference to element type.
typedef const Tp & | const_reference
| Constant reference to element type.
typedef Tp * | pointer
| Pointer to element type.
typedef const Tp * | const_pointer
| Pointer to constant element type.
typedef Tp * | iterator
| Iterator type.
typedef const Tp * | const_iterator
| Iterator type of constant elements.
typedef std::reverse_iterator< iterator > | reverse_iterator
| Reverse iterator type.
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator
| Reverse iterator of constant elements.
typedef std::ptrdiff_t | difference_type
| Difference between to iterators.
typedef std::size_t | size_t
| Type used for indexing elements.
typedef std::size_t | size_type
| Type used for indexing elements.

## Public Member Functions

| UVector (const allocator_type &allocator=Alloc()) noexcept
| Construct an empty UVector.
| UVector (size_t n)
| Construct a vector with given amount of elements, without initializing these.
| UVector (size_t n, const value_type &val, const allocator_type &allocator=Alloc())
| Construct a vector with given amount of elements and set these to a specific value.
template<class InputIterator>
| UVector (InputIterator first, InputIterator last, const allocator_type &allocator=Alloc())
| Construct a vector by copying elements from a range.
| UVector (const UVector< Tp, Alloc > &other)
| Copy construct a UVector.
| UVector (const UVector< Tp, Alloc > &other, const allocator_type &allocator)
| Copy construct a UVector with custom allocator.
| UVector (UVector< Tp, Alloc > &&other) noexcept
| Move construct a UVector.
| UVector (UVector< Tp, Alloc > &&other, const allocator_type &allocator) noexcept
| Move construct a UVector with custom allocator.
| UVector (std::initializer_list< Tp > initlist, const allocator_type &allocator=Alloc())
| Construct a UVector from a initializer list.
| ~UVector () noexcept
| Destructor.
UVector & | operator= (const UVector< Tp, Alloc > &other)
| Assign another UVector to this UVector.
UVector & | operator= (UVector< Tp, Alloc > &&other) noexcept(std::allocator_traits< Alloc >::propagate_on_container_move_assignment::value||allocator_is_always_equal::value)
| Assign another UVector to this UVector.
iterator | begin () noexcept
| Get iterator to first element.
const_iterator | begin () const noexcept
| Get constant iterator to first element.
iterator | end () noexcept
| Get iterator to element past last element.
const_iterator | end () const noexcept
| Get constant iterator to element past last element.
reverse_iterator | rbegin () noexcept
| Get reverse iterator to last element.
const_reverse_iterator | rbegin () const noexcept
| Get constant reverse iterator to last element.
reverse_iterator | rend () noexcept
| Get reverse iterator to element before first element.
const_reverse_iterator | rend () const noexcept
| Get constant reverse iterator to element before first element.
const_iterator | cbegin () const noexcept
| Get constant iterator to first element.
const_iterator | cend () const noexcept
| Get constant iterator to element past last element.
const_reverse_iterator | crbegin () const noexcept
| Get constant reverse iterator to last element.
const_reverse_iterator | crend () const noexcept
| Get constant reverse iterator to element before first element.
size_t | size () const noexcept
| Get number of elements in container.
size_t | max_size () const noexcept
| Get maximum number of elements that this container can hold.
void | resize (size_t n)
| Change the number of elements in the container.
void | resize (size_t n, const Tp &val)
| Change the number of elements in the container.
size_t | capacity () const noexcept
| Get the number of elements the container can currently hold without reallocating storage.
bool | empty () const noexcept
| Determine if the container is currently empty.
void | reserve (size_t n)
| Reserve space for a number of elements, to prevent the overhead of extra reallocations.
void | shrink_to_fit ()
| Change the capacity of the container such that no extra space is hold.
Tp & | operator[] (size_t index) noexcept
| Get a reference to the element at the given index.
const Tp & | operator[] (size_t index) const noexcept
| Get a constant reference to the element at the given index.
Tp & | at (size_t index)
| Get a reference to the element at the given index with bounds checking.
const Tp & | at (size_t index) const
| Get a constant reference to the element at the given index with bounds checking.
Tp & | front () noexcept
| Get reference to first element in container.
const Tp & | front () const noexcept
| Get constant reference to first element in container.
Tp & | back () noexcept
| Get reference to last element in container.
const Tp & | back () const noexcept
| Get constant reference to last element in container.
Tp * | data () noexcept
| Get pointer to internal storage.
const Tp * | data () const noexcept
| Get constant pointer to internal storage.
template<class InputIterator>
void | assign (InputIterator first, InputIterator last)
| Assign this container to be equal to the given range.
void | assign (size_t n, const Tp &val)
| Resize the container and assign the given value to all elements.
void | assign (std::initializer_list< Tp > initlist)
| Assign this container to an initializer list.
void | push_back (const Tp &item)
| Add the given value to the end of the container.
void | push_back (Tp &&item)
| Add the given value to the end of the container by moving it in.
void | pop_back ()
| Remove the last element from the container.
iterator | insert (const_iterator position, const Tp &item)
| Insert an element at a given position.
iterator | insert (const_iterator position, size_t n, const Tp &val)
| Insert elements at a given position and initialize them with a value.
template<class InputIterator>
iterator | insert (const_iterator position, InputIterator first, InputIterator last)
| Insert elements at a given position and initialize them from a range.
iterator | insert (const_iterator position, Tp &&item)
| Insert an element at a given position by moving it in.
iterator | insert (const_iterator position, std::initializer_list< Tp > initlist)
| Insert elements at a given position and initialize them from a initializer list.
iterator | erase (const_iterator position)
| Delete an element from the container.
iterator | erase (const_iterator first, const_iterator last)
| Delete a range of elements from the container.
void | swap (UVector< Tp, Alloc > &other) noexcept
| Swap the contents of this UVector with the given UVector.
void | clear ()
| Remove all elements from the container.
template<typename... Args>
iterator | emplace (const_iterator position, Args &&... args)
| Insert an element at a given position by constructing it in place.
template<typename... Args>
Tp & | emplace_back (Args &&... args)
| Add the given value to the end of the container by constructing it in place.
allocator_type | get_allocator () const noexcept
| Get a copy of the allocator.
iterator | insert_uninitialized (const_iterator position, size_t n)
| — NON STANDARD METHODS —
template<class InputIterator>
void | push_back (InputIterator first, InputIterator last)
| Add a range of items to the end of the container.
void | push_back (size_t n, const Tp &val)
| Add elements at the end and initialize them with a value.
void | push_back (std::initializer_list< Tp > initlist)
| Add elements from an initializer list to the end of the container.
void | push_back_uninitialized (size_t n)
| Add elements at the end without initializing them.

## Private Types

typedef std::false_type | allocator_is_always_equal

## Private Member Functions

pointer | allocate (size_t n)
void | deallocate () noexcept
void | deallocate (pointer begin, size_t n) noexcept
template<typename InputIterator>
void | construct_from_range (InputIterator first, InputIterator last, std::false_type)
template<typename Integral>
void | construct_from_range (Integral n, Integral val, std::true_type)
template<typename InputIterator>
void | construct_from_range (InputIterator first, InputIterator last, std::forward_iterator_tag)
template<typename InputIterator>
void | assign_from_range (InputIterator first, InputIterator last, std::false_type)
template<typename Integral>
void | assign_from_range (Integral n, Integral val, std::true_type)
| This function is called from assign(iter,iter) when Tp is an integral.
template<typename InputIterator>
void | assign_from_range (InputIterator first, InputIterator last, std::forward_iterator_tag)
template<typename InputIterator>
iterator | insert_from_range (const_iterator position, InputIterator first, InputIterator last, std::false_type)
template<typename Integral>
iterator | insert_from_range (const_iterator position, Integral n, Integral val, std::true_type)
template<typename InputIterator>
iterator | insert_from_range (const_iterator position, InputIterator first, InputIterator last, std::forward_iterator_tag)
void | check_bounds (size_t index) const
size_t | enlarge_size (size_t extra_space_needed) const noexcept
void | enlarge (size_t newSize)
void | enlarge_for_insert (size_t newSize, size_t insert_position, size_t insert_count)
UVector & | assign_copy_from (const UVector< Tp, Alloc > &other, std::false_type)
| implementation of operator=(const&) without propagate_on_container_copy_assignment
UVector & | assign_copy_from (const UVector< Tp, Alloc > &other, std::true_type)
| implementation of operator=(const&) with propagate_on_container_copy_assignment
UVector & | assign_move_from (UVector< Tp, Alloc > &&other, std::false_type) noexcept(allocator_is_always_equal::value)
| implementation of operator=() without propagate_on_container_move_assignment
UVector & | assign_move_from (UVector< Tp, Alloc > &&other, std::true_type) noexcept
| implementation of operator=() with propagate_on_container_move_assignment
void | swap (UVector< Tp, Alloc > &other, std::true_type) noexcept
| implementation of swap with propagate_on_container_swap
void | swap (UVector< Tp, Alloc > &other, std::false_type) noexcept
| implementation of swap without propagate_on_container_swap
template<typename InputIterator>
void | push_back_range (InputIterator first, InputIterator last, std::false_type)
template<typename Integral>
void | push_back_range (Integral n, Integral val, std::true_type)
| This function is called from push_back(iter,iter) when Tp is an integral.
template<typename InputIterator>
void | push_back_range (InputIterator first, InputIterator last, std::forward_iterator_tag)

## Private Attributes

pointer | _begin
pointer | _end
pointer | _endOfStorage

## Detailed Description

template<typename Tp, typename Alloc = std::allocator<Tp>>
class aocommon::UVector< Tp, Alloc >

A container similar to std::vector, but one that allows construction without initializing its elements.

This container is similar to a std::vector, except that it can be constructed without initializing its elements. This saves the overhead of initialization, hence the constructor UVector(size_t) is significantly faster than the corresponding std::vector constructor, and has no overhead compared to a manually allocated array.

Probably its greatest strength lies in the construction of containers with a number of elements that is runtime defined, but that will be initialized later. For example:

// Open a file
ifstream file("myfile.bin");
// Construct a buffer for this file
UVector<char> buffer(buffer_size);
// Read some data into the buffer
file.read(&buffer[0], buffer_size);
aocommon::UVector::UVector
UVector(const allocator_type &allocator=Alloc()) noexcept
Construct an empty UVector.
Definition uvector.h:121

However, it has a few more use-cases with improved performance over std::vector. This is possible because of more strengent requirements on the element's type.

The container will behave correctly with any trivial type, but will not work for almost all non-trivial types.

The methods with different semantics compared to std::vector are:

- UVector(size_t n)
- resize(size_t n)

Also the following new members are introduced:

- insert_uninitialized(const_iterator position, size_t n)
- push_back(InputIterator first, InputIterator last)
- push_back(size_t n, const Tp& val)
- push_back(std::initializer_list<Tp> initlist)
- push_back_uninitialized(size_t n)

All other members work exactly like std::vector's members, although some are slightly faster because of the stricter requirements on the element type.

Template Parameters

  Tp | Container's element type
  Alloc | Allocator type. Default is to use the std::allocator.

Author
  André Offringa

Copyright
  André Offringa, 2013, distributed under the GPL license version 3.

Definition at line 77 of file uvector.h.

## Member Typedef Documentation

## allocator_is_always_equal

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef std::false_type aocommon::UVector< Tp, Alloc >::allocator_is_always_equal

private

Definition at line 113 of file uvector.h.

## allocator_type

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef Alloc aocommon::UVector< Tp, Alloc >::allocator_type

Type of allocator used to allocate and deallocate space.

Definition at line 85 of file uvector.h.

## const_iterator

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef const Tp* aocommon::UVector< Tp, Alloc >::const_iterator

Iterator type of constant elements.

Definition at line 97 of file uvector.h.

## const_pointer

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef const Tp* aocommon::UVector< Tp, Alloc >::const_pointer

Pointer to constant element type.

Definition at line 93 of file uvector.h.

## const_reference

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef const Tp& aocommon::UVector< Tp, Alloc >::const_reference

Constant reference to element type.

Definition at line 89 of file uvector.h.

## const_reverse_iterator

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef std::reverse_iterator<const_iterator> aocommon::UVector< Tp, Alloc >::const_reverse_iterator

Reverse iterator of constant elements.

Definition at line 101 of file uvector.h.

## difference_type

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef std::ptrdiff_t aocommon::UVector< Tp, Alloc >::difference_type

Difference between to iterators.

Definition at line 103 of file uvector.h.

## iterator

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef Tp* aocommon::UVector< Tp, Alloc >::iterator

Iterator type.

Definition at line 95 of file uvector.h.

## pointer

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef Tp* aocommon::UVector< Tp, Alloc >::pointer

Pointer to element type.

Definition at line 91 of file uvector.h.

## reference

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef Tp& aocommon::UVector< Tp, Alloc >::reference

Reference to element type.

Definition at line 87 of file uvector.h.

## reverse_iterator

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef std::reverse_iterator<iterator> aocommon::UVector< Tp, Alloc >::reverse_iterator

Reverse iterator type.

Definition at line 99 of file uvector.h.

## size_t

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef std::size_t aocommon::UVector< Tp, Alloc >::size_t

Type used for indexing elements.

Definition at line 105 of file uvector.h.

## size_type

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef std::size_t aocommon::UVector< Tp, Alloc >::size_type

Type used for indexing elements.

Definition at line 107 of file uvector.h.

## value_type

template<typename Tp, typename Alloc = std::allocator<Tp>>

typedef Tp aocommon::UVector< Tp, Alloc >::value_type

Element type.

Definition at line 83 of file uvector.h.

## Constructor & Destructor Documentation

## UVector() [1/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::UVector | ( | const allocator_type & | allocator = Alloc() | ) |

inline explicit noexcept

Construct an empty UVector.

Parameters

  allocator | Allocator used for allocating and deallocating memory.

Definition at line 121 of file uvector.h.

References _begin, _end, and _endOfStorage.

Referenced by assign_copy_from(), assign_copy_from(), assign_move_from(), assign_move_from(), operator=(), operator=(), swap(), swap(), swap(), UVector(), UVector(), UVector(), and UVector().

## UVector() [2/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::UVector | ( | size_t | n | ) |

inline explicit

Construct a vector with given amount of elements, without initializing these.

This constructor deviates from std::vector's behaviour, because it will not value construct its elements. It is therefore faster than the corresponding constructor of std::vector.

Parameters

  n | Number of elements that the UVector will be initialized with.

Definition at line 131 of file uvector.h.

References _begin, _end, _endOfStorage, and allocate().

## UVector() [3/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::UVector | ( | size_t | n,
|  | const value_type & | val,
|  | const allocator_type & | allocator = Alloc() )

inline

Construct a vector with given amount of elements and set these to a specific value.

This constructor will initialize its members with the given value.

Parameters

  n | Number of elements that the UVector will be initialized with.
  val | Value to initialize all elements with
  allocator | Allocator used for allocating and deallocating memory.

Definition at line 140 of file uvector.h.

References _begin, _end, _endOfStorage, and allocate().

## UVector() [4/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<class InputIterator>

aocommon::UVector< Tp, Alloc >::UVector | ( | InputIterator | first,
|  | InputIterator | last,
|  | const allocator_type & | allocator = Alloc() )

inline

Construct a vector by copying elements from a range.

Parameters

  first | Iterator to range start
  last | Iterator to range end
  allocator | Allocator used for allocating and deallocating memory.

Definition at line 151 of file uvector.h.

References construct_from_range(), and first.

## UVector() [5/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::UVector | ( | const UVector< Tp, Alloc > & | other | ) |

inline

Copy construct a UVector.

The allocator of the new UVector will be initialized from `std::allocator_traits<Alloc>::select_on_container_copy_construction(other)`.

Parameters

  other | Source UVector to be copied from.

Definition at line 162 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), size(), and UVector().

## UVector() [6/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::UVector | ( | const UVector< Tp, Alloc > & | other,
|  | const allocator_type & | allocator )

inline

Copy construct a UVector with custom allocator.

Parameters

  other | Source UVector to be copied from.
  allocator | Allocator used for allocating and deallocating memory.

Definition at line 175 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), size(), and UVector().

## UVector() [7/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::UVector | ( | UVector< Tp, Alloc > && | other | ) |

inline noexcept

Move construct a UVector.

Parameters

  other | Source UVector to be moved from.

Definition at line 186 of file uvector.h.

References UVector().

## UVector() [8/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::UVector | ( | UVector< Tp, Alloc > && | other,
|  | const allocator_type & | allocator )

inline noexcept

Move construct a UVector with custom allocator.

Parameters

  other | Source UVector to be moved from.
  allocator | Allocator used for allocating and deallocating memory.

Definition at line 200 of file uvector.h.

References UVector().

## UVector() [9/9]

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::UVector | ( | std::initializer_list< Tp > | initlist,
|  | const allocator_type & | allocator = Alloc() )

inline

Construct a UVector from a initializer list.

Parameters

  initlist | Initializer list used for initializing the new UVector.
  allocator | Allocator used for allocating and deallocating memory.

Definition at line 214 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), and size().

## ~UVector()

template<typename Tp, typename Alloc = std::allocator<Tp>>

aocommon::UVector< Tp, Alloc >::~UVector | ( |  | ) |

inline noexcept

Destructor.

Definition at line 228 of file uvector.h.

References deallocate().

## Member Function Documentation

## allocate()

template<typename Tp, typename Alloc = std::allocator<Tp>>

pointer aocommon::UVector< Tp, Alloc >::allocate | ( | size_t | n | ) |

inline private

Definition at line 785 of file uvector.h.

Referenced by assign(), assign(), assign_copy_from(), assign_copy_from(), assign_from_range(), assign_from_range(), construct_from_range(), construct_from_range(), enlarge(), enlarge_for_insert(), reserve(), resize(), resize(), shrink_to_fit(), UVector(), UVector(), UVector(), UVector(), and UVector().

## assign() [1/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<class InputIterator>

void aocommon::UVector< Tp, Alloc >::assign | ( | InputIterator | first,
|  | InputIterator | last )

inline

Assign this container to be equal to the given range.

The container will be resized to fit the length of the given range. Iterators are invalidated.

Parameters

  first | Iterator to the beginning of the range.
  last | Iterator past the end of the range.

Definition at line 444 of file uvector.h.

References assign_from_range(), and first.

## assign() [2/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::assign | ( | size_t | n,
|  | const Tp & | val )

inline

Resize the container and assign the given value to all elements.

Iterators are invalidated.

Parameters

  n | New size of container
  val | Value to be assigned to all elements.

Definition at line 453 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), and deallocate().

## assign() [3/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::assign | ( | std::initializer_list< Tp > | initlist | ) |

inline

Assign this container to an initializer list.

The container will be resized to fit the length of the given initializer list. Iterators are invalidated.

Parameters

  initlist | List of values to assign to the container.

Definition at line 469 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), and deallocate().

## assign_copy_from() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

UVector & aocommon::UVector< Tp, Alloc >::assign_copy_from | ( | const UVector< Tp, Alloc > & | other,
|  | std::false_type | )

inline private

implementation of operator=(const&) without propagate_on_container_copy_assignment

Definition at line 931 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), deallocate(), size(), and UVector().

Referenced by assign_copy_from(), assign_move_from(), and operator=().

## assign_copy_from() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

UVector & aocommon::UVector< Tp, Alloc >::assign_copy_from | ( | const UVector< Tp, Alloc > & | other,
|  | std::true_type | )

inline private

implementation of operator=(const&) with propagate_on_container_copy_assignment

Definition at line 946 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), assign_copy_from(), deallocate(), size(), and UVector().

## assign_from_range() [1/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename InputIterator>

void aocommon::UVector< Tp, Alloc >::assign_from_range | ( | InputIterator | first,
|  | InputIterator | last,
|  | std::false_type | )

inline private

Definition at line 822 of file uvector.h.

References assign_from_range(), and first.

Referenced by assign(), and assign_from_range().

## assign_from_range() [2/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename InputIterator>

void aocommon::UVector< Tp, Alloc >::assign_from_range | ( | InputIterator | first,
|  | InputIterator | last,
|  | std::forward_iterator_tag | )

inline private

Definition at line 843 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), deallocate(), and first.

## assign_from_range() [3/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename Integral>

void aocommon::UVector< Tp, Alloc >::assign_from_range | ( | Integral | n,
|  | Integral | val,
|  | std::true_type | )

inline private

This function is called from assign(iter,iter) when Tp is an integral.

In that case, the user tried to call assign(n, &val), but it got caught by the wrong overload.

Definition at line 831 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), and deallocate().

## assign_move_from() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

UVector & aocommon::UVector< Tp, Alloc >::assign_move_from | ( | UVector< Tp, Alloc > && | other,
|  | std::false_type | )

inline private noexcept

implementation of operator=() without propagate_on_container_move_assignment

We should not propagate the allocator and the allocators are different. This means we can not swap the allocated space, since then we would deallocate the space with a different allocator type. Therefore, we need to copy:

Definition at line 964 of file uvector.h.

References _begin, _end, _endOfStorage, assign_copy_from(), deallocate(), and UVector().

Referenced by operator=().

## assign_move_from() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

UVector & aocommon::UVector< Tp, Alloc >::assign_move_from | ( | UVector< Tp, Alloc > && | other,
|  | std::true_type | )

inline private noexcept

implementation of operator=() with propagate_on_container_move_assignment

Definition at line 986 of file uvector.h.

References _begin, _end, _endOfStorage, deallocate(), and UVector().

## at() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

Tp & aocommon::UVector< Tp, Alloc >::at | ( | size_t | index | ) |

inline

Get a reference to the element at the given index with bounds checking.

Exceptions

  std::out_of_range | when given index is past the last element.

Definition at line 405 of file uvector.h.

References _begin, and check_bounds().

## at() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const Tp & aocommon::UVector< Tp, Alloc >::at | ( | size_t | index | ) | const

inline

Get a constant reference to the element at the given index with bounds checking.

Exceptions

  std::out_of_range | when given index is past the last element.

Definition at line 414 of file uvector.h.

References _begin, and check_bounds().

## back() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const Tp & aocommon::UVector< Tp, Alloc >::back | ( |  | ) | const

inline noexcept

Get constant reference to last element in container.

Definition at line 429 of file uvector.h.

References _end.

## back() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

Tp & aocommon::UVector< Tp, Alloc >::back | ( |  | ) |

inline noexcept

Get reference to last element in container.

Definition at line 426 of file uvector.h.

References _end.

Referenced by emplace_back().

## begin() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const_iterator aocommon::UVector< Tp, Alloc >::begin | ( |  | ) | const

inline noexcept

Get constant iterator to first element.

Definition at line 257 of file uvector.h.

References _begin.

## begin() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::begin | ( |  | ) |

inline noexcept

Get iterator to first element.

Definition at line 254 of file uvector.h.

References _begin.

Referenced by crend(), deallocate(), rend(), and rend().

## capacity()

template<typename Tp, typename Alloc = std::allocator<Tp>>

size_t aocommon::UVector< Tp, Alloc >::capacity | ( |  | ) | const

inline noexcept

Get the number of elements the container can currently hold without reallocating storage.

Definition at line 340 of file uvector.h.

References _begin, and _endOfStorage.

Referenced by assign(), assign(), assign_copy_from(), assign_from_range(), assign_from_range(), deallocate(), insert(), insert(), insert_from_range(), insert_from_range(), insert_uninitialized(), push_back(), push_back(), push_back_range(), push_back_range(), reserve(), resize(), resize(), and shrink_to_fit().

## cbegin()

template<typename Tp, typename Alloc = std::allocator<Tp>>

const_iterator aocommon::UVector< Tp, Alloc >::cbegin | ( |  | ) | const

inline noexcept

Get constant iterator to first element.

Definition at line 278 of file uvector.h.

References _begin.

## cend()

template<typename Tp, typename Alloc = std::allocator<Tp>>

const_iterator aocommon::UVector< Tp, Alloc >::cend | ( |  | ) | const

inline noexcept

Get constant iterator to element past last element.

Definition at line 281 of file uvector.h.

References _end.

## check_bounds()

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::check_bounds | ( | size_t | index | ) | const

inline private

Definition at line 902 of file uvector.h.

References size().

Referenced by at(), and at().

## clear()

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::clear | ( |  | ) |

inline

Remove all elements from the container.

Definition at line 666 of file uvector.h.

References _begin, and _end.

## construct_from_range() [1/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename InputIterator>

void aocommon::UVector< Tp, Alloc >::construct_from_range | ( | InputIterator | first,
|  | InputIterator | last,
|  | std::false_type | )

inline private

Definition at line 794 of file uvector.h.

References construct_from_range(), and first.

Referenced by construct_from_range(), and UVector().

## construct_from_range() [2/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename InputIterator>

void aocommon::UVector< Tp, Alloc >::construct_from_range | ( | InputIterator | first,
|  | InputIterator | last,
|  | std::forward_iterator_tag | )

inline private

Definition at line 808 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), and first.

## construct_from_range() [3/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename Integral>

void aocommon::UVector< Tp, Alloc >::construct_from_range | ( | Integral | n,
|  | Integral | val,
|  | std::true_type | )

inline private

Definition at line 800 of file uvector.h.

References _begin, _end, _endOfStorage, and allocate().

## crbegin()

template<typename Tp, typename Alloc = std::allocator<Tp>>

const_reverse_iterator aocommon::UVector< Tp, Alloc >::crbegin | ( |  | ) | const

inline noexcept

Get constant reverse iterator to last element.

Definition at line 284 of file uvector.h.

References end().

## crend()

template<typename Tp, typename Alloc = std::allocator<Tp>>

const_reverse_iterator aocommon::UVector< Tp, Alloc >::crend | ( |  | ) | const

inline noexcept

Get constant reverse iterator to element before first element.

Definition at line 287 of file uvector.h.

References begin().

## data() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const Tp * aocommon::UVector< Tp, Alloc >::data | ( |  | ) | const

inline noexcept

Get constant pointer to internal storage.

Definition at line 435 of file uvector.h.

References _begin.

## data() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

Tp * aocommon::UVector< Tp, Alloc >::data | ( |  | ) |

inline noexcept

Get pointer to internal storage.

Definition at line 432 of file uvector.h.

References _begin.

## deallocate() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::deallocate | ( |  | ) |

inline private noexcept

Definition at line 787 of file uvector.h.

References _begin, capacity(), and deallocate().

Referenced by assign(), assign(), assign_copy_from(), assign_copy_from(), assign_from_range(), assign_from_range(), assign_move_from(), assign_move_from(), deallocate(), enlarge(), enlarge_for_insert(), reserve(), resize(), resize(), shrink_to_fit(), and ~UVector().

## deallocate() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::deallocate | ( | pointer | begin,
|  | size_t | n )

inline private noexcept

Definition at line 789 of file uvector.h.

References begin().

## emplace()

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename... Args>

iterator aocommon::UVector< Tp, Alloc >::emplace | ( | const_iterator | position,
|  | Args &&... | args )

inline

Insert an element at a given position by constructing it in place.

All iterators will be invalidated. This operation needs to move all elements after the new element, and can therefore be expensive.

Parameters

  position | Position of the new element. The new element will be added before the old element at that position.
  args | List of arguments to be forwarded to construct the new element.

Returns
  Position of the new element.

Definition at line 677 of file uvector.h.

References _begin, _end, _endOfStorage, enlarge_for_insert(), and enlarge_size().

## emplace_back()

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename... Args>

Tp & aocommon::UVector< Tp, Alloc >::emplace_back | ( | Args &&... | args | ) |

inline

Add the given value to the end of the container by constructing it in place.

Iterators are invalidated.

Parameters

  args | List of arguments to be forwarded to construct the new element.

Definition at line 696 of file uvector.h.

References _end, _endOfStorage, back(), enlarge(), and enlarge_size().

## empty()

template<typename Tp, typename Alloc = std::allocator<Tp>>

bool aocommon::UVector< Tp, Alloc >::empty | ( |  | ) | const

inline noexcept

Determine if the container is currently empty.

Returns
  `true` if size() == 0.

Definition at line 344 of file uvector.h.

References _begin, and _end.

## end() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const_iterator aocommon::UVector< Tp, Alloc >::end | ( |  | ) | const

inline noexcept

Get constant iterator to element past last element.

Definition at line 263 of file uvector.h.

References _end.

## end() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::end | ( |  | ) |

inline noexcept

Get iterator to element past last element.

Definition at line 260 of file uvector.h.

References _end.

Referenced by crbegin(), rbegin(), and rbegin().

## enlarge()

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::enlarge | ( | size_t | newSize | ) |

inline private

Definition at line 910 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), deallocate(), and size().

Referenced by emplace_back(), push_back(), push_back(), push_back(), push_back(), push_back_range(), and push_back_range().

## enlarge_for_insert()

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::enlarge_for_insert | ( | size_t | newSize,
|  | size_t | insert_position,
|  | size_t | insert_count )

inline private

Definition at line 919 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), deallocate(), and size().

Referenced by emplace(), insert(), insert(), insert(), insert(), insert_from_range(), insert_from_range(), and insert_uninitialized().

## enlarge_size()

template<typename Tp, typename Alloc = std::allocator<Tp>>

size_t aocommon::UVector< Tp, Alloc >::enlarge_size | ( | size_t | extra_space_needed | ) | const

inline private noexcept

Definition at line 906 of file uvector.h.

References size().

Referenced by emplace(), emplace_back(), insert(), insert(), insert(), insert(), insert_from_range(), insert_from_range(), insert_uninitialized(), push_back(), push_back(), push_back(), push_back(), push_back_range(), push_back_range(), and resize().

## erase() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::erase | ( | const_iterator | first,
|  | const_iterator | last )

inline

Delete a range of elements from the container.

This operation moves all elements past the removed elements, and can therefore be expensive.

Parameters

  first | Position of first element to be removed.
  last | Position past last element to be removed.

Returns
  Iterator pointing to the first element past the delete element.

Definition at line 644 of file uvector.h.

References _end, and first.

## erase() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::erase | ( | const_iterator | position | ) |

inline

Delete an element from the container.

This operation moves all elements past the removed element, and can therefore be expensive.

Parameters

  position | Position of element to be removed.

Returns
  Iterator pointing to the first element past the delete element.

Definition at line 631 of file uvector.h.

References _end.

## front() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const Tp & aocommon::UVector< Tp, Alloc >::front | ( |  | ) | const

inline noexcept

Get constant reference to first element in container.

Definition at line 423 of file uvector.h.

References _begin.

## front() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

Tp & aocommon::UVector< Tp, Alloc >::front | ( |  | ) |

inline noexcept

Get reference to first element in container.

Definition at line 420 of file uvector.h.

References _begin.

## get_allocator()

template<typename Tp, typename Alloc = std::allocator<Tp>>

allocator_type aocommon::UVector< Tp, Alloc >::get_allocator | ( |  | ) | const

inline noexcept

Get a copy of the allocator.

Definition at line 704 of file uvector.h.

## insert() [1/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::insert | ( | const_iterator | position,
|  | const Tp & | item )

inline

Insert an element at a given position.

All iterators will be invalidated. This operation needs to move all elements after the new element, and can therefore be expensive.

Parameters

  position | Position of the new element. The new element will be added before the old element at that position.
  item | Value of the new item.

Returns
  Position of the new element.

Definition at line 520 of file uvector.h.

References _begin, _end, _endOfStorage, enlarge_for_insert(), and enlarge_size().

## insert() [2/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<class InputIterator>

iterator aocommon::UVector< Tp, Alloc >::insert | ( | const_iterator | position,
|  | InputIterator | first,
|  | InputIterator | last )

inline

Insert elements at a given position and initialize them from a range.

All iterators will be invalidated. This operation needs to move all elements after the new element, and can therefore be expensive.

Parameters

  position | Position of the new elements. The new elements will be added before the old element at that position.
  first | Iterator to the beginning of the range.
  last | Iterator past the end of the range.

Returns
  Position of the first new element.

Definition at line 567 of file uvector.h.

References first, and insert_from_range().

## insert() [3/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::insert | ( | const_iterator | position,
|  | size_t | n,
|  | const Tp & | val )

inline

Insert elements at a given position and initialize them with a value.

All iterators will be invalidated. This operation needs to move all elements after the new element, and can therefore be expensive.

Parameters

  position | Position of the new elements. The new elements will be added before the old element at that position.
  n | Number of elements to add.
  val | Value of the new item.

Returns
  Position of the first new element.

Definition at line 543 of file uvector.h.

References _begin, _end, capacity(), enlarge_for_insert(), enlarge_size(), and size().

## insert() [4/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::insert | ( | const_iterator | position,
|  | std::initializer_list< Tp > | initlist )

inline

Insert elements at a given position and initialize them from a initializer list.

All iterators will be invalidated. This operation needs to move all elements after the new element, and can therefore be expensive.

Parameters

  position | Position of the new elements. The new elements will be added before the old element at that position.
  initlist | List of items to insert.

Returns
  Position of the first new element.

Definition at line 607 of file uvector.h.

References _begin, _end, capacity(), enlarge_for_insert(), enlarge_size(), and size().

## insert() [5/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::insert | ( | const_iterator | position,
|  | Tp && | item )

inline

Insert an element at a given position by moving it in.

All iterators will be invalidated. This operation needs to move all elements after the new element, and can therefore be expensive.

Note that this container can only hold simple types that do not perform allocations. Therefore, there is probably no benefit in moving the new item in over copying it in with insert(const_iterator, const Tp&).

Parameters

  position | Position of the new element. The new element will be added before the old element at that position.
  item | Value of the new item.

Returns
  Position of the new element.

Definition at line 585 of file uvector.h.

References _begin, _end, _endOfStorage, enlarge_for_insert(), and enlarge_size().

## insert_from_range() [1/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename InputIterator>

iterator aocommon::UVector< Tp, Alloc >::insert_from_range | ( | const_iterator | position,
|  | InputIterator | first,
|  | InputIterator | last,
|  | std::false_type | )

inline private

Definition at line 861 of file uvector.h.

References first, and insert_from_range().

Referenced by insert(), and insert_from_range().

## insert_from_range() [2/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename InputIterator>

iterator aocommon::UVector< Tp, Alloc >::insert_from_range | ( | const_iterator | position,
|  | InputIterator | first,
|  | InputIterator | last,
|  | std::forward_iterator_tag | )

inline private

Definition at line 882 of file uvector.h.

References _begin, _end, capacity(), enlarge_for_insert(), enlarge_size(), first, and size().

## insert_from_range() [3/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename Integral>

iterator aocommon::UVector< Tp, Alloc >::insert_from_range | ( | const_iterator | position,
|  | Integral | n,
|  | Integral | val,
|  | std::true_type | )

inline private

Definition at line 868 of file uvector.h.

References _begin, _end, capacity(), enlarge_for_insert(), enlarge_size(), and size().

## insert_uninitialized()

template<typename Tp, typename Alloc = std::allocator<Tp>>

iterator aocommon::UVector< Tp, Alloc >::insert_uninitialized | ( | const_iterator | position,
|  | size_t | n )

inline

— NON STANDARD METHODS —

Insert elements at a given position without initializing them.

All iterators will be invalidated. This operation needs to move all elements after the new element, and can therefore be expensive. It will not initialize the new elements, and is therefore faster than insert(const_iterator, size_t, const Tp&).

This method is non-standard: it is not present in std::vector.

Parameters

  position | Position of the new elements. The new elements will be added before the old element at that position.
  n | Number of elements to add.

Returns
  Iterator pointing to the start position of the written sequence

Definition at line 720 of file uvector.h.

References _begin, _end, capacity(), enlarge_for_insert(), enlarge_size(), and size().

## max_size()

template<typename Tp, typename Alloc = std::allocator<Tp>>

size_t aocommon::UVector< Tp, Alloc >::max_size | ( |  | ) | const

inline noexcept

Get maximum number of elements that this container can hold.

Definition at line 293 of file uvector.h.

## operator=() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

UVector & aocommon::UVector< Tp, Alloc >::operator= | ( | const UVector< Tp, Alloc > & | other | ) |

inline

Assign another UVector to this UVector.

The allocator of the UVector will be assigned to `other` when std::allocator_traits<Alloc>::propagate_on_container_copy_assignment() is of true_type.

Definition at line 235 of file uvector.h.

References assign_copy_from(), and UVector().

## operator=() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

UVector & aocommon::UVector< Tp, Alloc >::operator= | ( | UVector< Tp, Alloc > && | other | ) |

inline noexcept

Assign another UVector to this UVector.

The allocator of the UVector will be assigned to `other` when std::allocator_traits<Alloc>::propagate_on_container_move_assignment() is of true_type.

Definition at line 245 of file uvector.h.

References assign_move_from(), and UVector().

## operator[]() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const Tp & aocommon::UVector< Tp, Alloc >::operator[] | ( | size_t | index | ) | const

inline noexcept

Get a constant reference to the element at the given index.

Definition at line 399 of file uvector.h.

References _begin.

## operator[]() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

Tp & aocommon::UVector< Tp, Alloc >::operator[] | ( | size_t | index | ) |

inline noexcept

Get a reference to the element at the given index.

Definition at line 396 of file uvector.h.

References _begin.

## pop_back()

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::pop_back | ( |  | ) |

inline

Remove the last element from the container.

Definition at line 510 of file uvector.h.

References _end.

## push_back() [1/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::push_back | ( | const Tp & | item | ) |

inline

Add the given value to the end of the container.

Iterators are invalidated.

Parameters

  item | Value of new element.

Definition at line 489 of file uvector.h.

References _end, _endOfStorage, enlarge(), and enlarge_size().

## push_back() [2/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<class InputIterator>

void aocommon::UVector< Tp, Alloc >::push_back | ( | InputIterator | first,
|  | InputIterator | last )

inline

Add a range of items to the end of the container.

All iterators will be invalidated.

This method is non-standard: it is not present in std::vector.

Parameters

  first | Iterator to the beginning of the range.
  last | Iterator past the end of the range.

Definition at line 740 of file uvector.h.

References first, and push_back_range().

## push_back() [3/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::push_back | ( | size_t | n,
|  | const Tp & | val )

inline

Add elements at the end and initialize them with a value.

All iterators will be invalidated.

This method is non-standard: it is not present in std::vector.

Parameters

  n | Number of elements to add.
  val | Value of the new items.

Definition at line 751 of file uvector.h.

References _end, capacity(), enlarge(), enlarge_size(), and size().

## push_back() [4/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::push_back | ( | std::initializer_list< Tp > | initlist | ) |

inline

Add elements from an initializer list to the end of the container.

All iterators will be invalidated.

This method is non-standard: it is not present in std::vector.

Parameters

  initlist | The list with values to add.

Definition at line 765 of file uvector.h.

References _end, capacity(), enlarge(), enlarge_size(), and size().

## push_back() [5/5]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::push_back | ( | Tp && | item | ) |

inline

Add the given value to the end of the container by moving it in.

Iterators are invalidated.

Note that this container can only hold simple types that do not perform allocations. Therefore, there is probably no benefit in moving the new item in over copying it in with push_back(const Tp&).

Parameters

  item | Value of new element.

Definition at line 503 of file uvector.h.

References _end, _endOfStorage, enlarge(), and enlarge_size().

## push_back_range() [1/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename InputIterator>

void aocommon::UVector< Tp, Alloc >::push_back_range | ( | InputIterator | first,
|  | InputIterator | last,
|  | std::false_type | )

inline private

Definition at line 1037 of file uvector.h.

References first, and push_back_range().

Referenced by push_back(), and push_back_range().

## push_back_range() [2/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename InputIterator>

void aocommon::UVector< Tp, Alloc >::push_back_range | ( | InputIterator | first,
|  | InputIterator | last,
|  | std::forward_iterator_tag | )

inline private

Definition at line 1055 of file uvector.h.

References _end, capacity(), enlarge(), enlarge_size(), first, and size().

## push_back_range() [3/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>
template<typename Integral>

void aocommon::UVector< Tp, Alloc >::push_back_range | ( | Integral | n,
|  | Integral | val,
|  | std::true_type | )

inline private

This function is called from push_back(iter,iter) when Tp is an integral.

In that case, the user tried to call push_back(n, &val), but it got caught by the wrong overload.

Definition at line 1046 of file uvector.h.

References _end, capacity(), enlarge(), enlarge_size(), and size().

## push_back_uninitialized()

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::push_back_uninitialized | ( | size_t | n | ) |

inline

Add elements at the end without initializing them.

All iterators will be invalidated.

This method is non-standard: it is not present in std::vector.

Parameters

  n | Number of elements to add.

Definition at line 782 of file uvector.h.

References resize(), and size().

## rbegin() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const_reverse_iterator aocommon::UVector< Tp, Alloc >::rbegin | ( |  | ) | const

inline noexcept

Get constant reverse iterator to last element.

Definition at line 269 of file uvector.h.

References end().

## rbegin() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

reverse_iterator aocommon::UVector< Tp, Alloc >::rbegin | ( |  | ) |

inline noexcept

Get reverse iterator to last element.

Definition at line 266 of file uvector.h.

References end().

## rend() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

const_reverse_iterator aocommon::UVector< Tp, Alloc >::rend | ( |  | ) | const

inline noexcept

Get constant reverse iterator to element before first element.

Definition at line 275 of file uvector.h.

References begin().

## rend() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

reverse_iterator aocommon::UVector< Tp, Alloc >::rend | ( |  | ) |

inline noexcept

Get reverse iterator to element before first element.

Definition at line 272 of file uvector.h.

References begin().

## reserve()

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::reserve | ( | size_t | n | ) |

inline

Reserve space for a number of elements, to prevent the overhead of extra reallocations.

This has no effect on the working of the UVector, except that it might change the current capacity. This can enhance performance when a large number of elements are added, and an approximate size is known a priori.

This method might cause a reallocation, causing iterators to be invalidated.

Parameters

  n | Number of elements to reserve space for.

Definition at line 357 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), deallocate(), and size().

## resize() [1/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::resize | ( | size_t | n | ) |

inline

Change the number of elements in the container.

If the new size is larger than the current size, new values will be left uninitialized. Therefore, it is more efficient than `resize(size_t)` in `std::vector`, as well as resize(size_t, const Tp&). If the new size is smaller than the current size, the container will be truncated and elements past the new size will be removed. No destructor of the removed elements will be called.

Parameters

  n | The new size of the container.

Definition at line 305 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), deallocate(), and enlarge_size().

Referenced by push_back_uninitialized().

## resize() [2/2]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::resize | ( | size_t | n,
|  | const Tp & | val )

inline

Change the number of elements in the container.

If the new size is larger than the current size, new values will be initialized by the given value. If the new size is smaller than the current size, the container will be truncated and elements past the new size will be removed. No destructor of the removed elements will be called.

Parameters

  n | The new size of the container.
  val | New value of elements that get added to the container.

Definition at line 325 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), deallocate(), and size().

## shrink_to_fit()

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::shrink_to_fit | ( |  | ) |

inline

Change the capacity of the container such that no extra space is hold.

This has no effect on the working of the UVector, except that it might change the current capacity. This can reduce the current memory usage of the container.

This method might cause a reallocation, causing iterators to be invalidated.

Definition at line 378 of file uvector.h.

References _begin, _end, _endOfStorage, allocate(), capacity(), deallocate(), and size().

## size()

template<typename Tp, typename Alloc = std::allocator<Tp>>

size_t aocommon::UVector< Tp, Alloc >::size | ( |  | ) | const

inline noexcept

Get number of elements in container.

Definition at line 290 of file uvector.h.

References _begin, and _end.

Referenced by assign_copy_from(), assign_copy_from(), check_bounds(), enlarge(), enlarge_for_insert(), enlarge_size(), insert(), insert(), insert_from_range(), insert_from_range(), insert_uninitialized(), push_back(), push_back(), push_back_range(), push_back_range(), push_back_uninitialized(), reserve(), resize(), shrink_to_fit(), UVector(), UVector(), and UVector().

## swap() [1/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::swap | ( | UVector< Tp, Alloc > & | other | ) |

inline noexcept

Swap the contents of this UVector with the given UVector.

Iterators to both vectors will remain valid and will point into to the swapped container afterwards. This function will never reallocate space.

The allocator will be swapped when the `propagate_on_container_swap` of the respective `allocator_trait` is `true_type`. Its behaviour is undefined when the allocators do not compare equal and `propagate_on_container_swap` is false.

Parameters

  other | Other UVector whose contents it to be swapped with this.

Definition at line 661 of file uvector.h.

References swap(), and UVector().

Referenced by aocommon::swap(), and swap().

## swap() [2/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::swap | ( | UVector< Tp, Alloc > & | other,
|  | std::false_type | )

inline private noexcept

implementation of swap without propagate_on_container_swap

We have two choices here:

- Do not swap the allocators. For stateful allocators, we would need to reallocate memory, and iterators would not be valid UNLESS they were stored as indices. However, containers with stateful allocators are not allowed to be swapped unless the allocators are equal, in which case swapping is not necessary.
- Swap the allocators. This would not reallocate memory and iterators remain valid, but the trait ignores propagate_on_container_swap.

The standard says: "Allocator replacement is performed by copy assignment, move assignment, or swapping of the allocator only if allocator_traits<allocatortype>:: propagate_on_container_copy_assignment::value, allocator_traits<allocatortype>::propagate_on_container_move_assignment::value, or allocator_traits<allocatortype>::propagate_on_container_swap::value is true within the implementation of the corresponding container operation. The behavior of a call to a container’s swap function is undefined unless the objects being swapped have allocators that compare equal or allocator_traits<allocatortype>::propagate_on_container_swap::value is true."

Definition at line 1007 of file uvector.h.

References _begin, _end, _endOfStorage, and UVector().

## swap() [3/3]

template<typename Tp, typename Alloc = std::allocator<Tp>>

void aocommon::UVector< Tp, Alloc >::swap | ( | UVector< Tp, Alloc > & | other,
|  | std::true_type | )

inline private noexcept

implementation of swap with propagate_on_container_swap

Definition at line 999 of file uvector.h.

References _begin, _end, _endOfStorage, and UVector().

## Member Data Documentation

## _begin

template<typename Tp, typename Alloc = std::allocator<Tp>>

pointer aocommon::UVector< Tp, Alloc >::_begin

private

Definition at line 115 of file uvector.h.

Referenced by assign(), assign(), assign_copy_from(), assign_copy_from(), assign_from_range(), assign_from_range(), assign_move_from(), assign_move_from(), at(), at(), begin(), begin(), capacity(), cbegin(), clear(), construct_from_range(), construct_from_range(), data(), data(), deallocate(), emplace(), empty(), enlarge(), enlarge_for_insert(), front(), front(), insert(), insert(), insert(), insert(), insert_from_range(), insert_from_range(), insert_uninitialized(), operator[](), operator[](), reserve(), resize(), resize(), shrink_to_fit(), size(), swap(), swap(), UVector(), UVector(), UVector(), UVector(), UVector(), and UVector().

## _end

template<typename Tp, typename Alloc = std::allocator<Tp>>

pointer aocommon::UVector< Tp, Alloc >::_end

private

Definition at line 115 of file uvector.h.

Referenced by assign(), assign(), assign_copy_from(), assign_copy_from(), assign_from_range(), assign_from_range(), assign_move_from(), assign_move_from(), back(), back(), cend(), clear(), construct_from_range(), construct_from_range(), emplace(), emplace_back(), empty(), end(), end(), enlarge(), enlarge_for_insert(), erase(), erase(), insert(), insert(), insert(), insert(), insert_from_range(), insert_from_range(), insert_uninitialized(), pop_back(), push_back(), push_back(), push_back(), push_back(), push_back_range(), push_back_range(), reserve(), resize(), resize(), shrink_to_fit(), size(), swap(), swap(), UVector(), UVector(), UVector(), UVector(), UVector(), and UVector().

## _endOfStorage

template<typename Tp, typename Alloc = std::allocator<Tp>>

pointer aocommon::UVector< Tp, Alloc >::_endOfStorage

private

Definition at line 115 of file uvector.h.

Referenced by assign(), assign(), assign_copy_from(), assign_copy_from(), assign_from_range(), assign_from_range(), assign_move_from(), assign_move_from(), capacity(), construct_from_range(), construct_from_range(), emplace(), emplace_back(), enlarge(), enlarge_for_insert(), insert(), insert(), push_back(), push_back(), reserve(), resize(), resize(), shrink_to_fit(), swap(), swap(), UVector(), UVector(), UVector(), UVector(), UVector(), and UVector().

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

- tables/Dysco/uvector.h