WPILibC++ 2024.3.2
wpi::UidVector< T, reuse_threshold > Class Template Reference

Vector which provides an integrated freelist for removal and reuse of individual elements. More...

#include <wpi/UidVector.h>

Public Types

using value_type = T
 
using pointer = T *
 
using const_pointer = const T *
 
using reference = T &
 
using const_reference = const T &
 
using size_type = typename std::vector< T >::size_type
 
using difference_type = typename std::vector< T >::difference_type
 
using iterator = impl::UidVectorIterator< typename std::vector< T >::iterator >
 
using const_iterator = impl::UidVectorIterator< typename std::vector< T >::const_iterator >
 

Public Member Functions

bool empty () const noexcept
 
size_type size () const noexcept
 
T & operator[] (size_type i)
 
const T & operator[] (size_type i) const
 
template<class... Args>
size_type emplace_back (Args &&... args)
 
erase (size_type uid)
 Removes the identified element by replacing it with a default-constructed one. More...
 
void clear () noexcept
 Removes all elements. More...
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 

Detailed Description

template<typename T, typename std::vector< T >::size_type reuse_threshold>
class wpi::UidVector< T, reuse_threshold >

Vector which provides an integrated freelist for removal and reuse of individual elements.

Template Parameters
Telement type; must be default-constructible and evaluate in boolean context to false when "empty"
reuse_thresholdhow many free elements to store up before starting to recycle them

Member Typedef Documentation

◆ const_iterator

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::const_iterator = impl::UidVectorIterator<typename std::vector<T>::const_iterator>

◆ const_pointer

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::const_pointer = const T*

◆ const_reference

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::const_reference = const T&

◆ difference_type

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::difference_type = typename std::vector<T>::difference_type

◆ iterator

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::iterator = impl::UidVectorIterator<typename std::vector<T>::iterator>

◆ pointer

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::pointer = T*

◆ reference

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::reference = T&

◆ size_type

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::size_type = typename std::vector<T>::size_type

◆ value_type

template<typename T , typename std::vector< T >::size_type reuse_threshold>
using wpi::UidVector< T, reuse_threshold >::value_type = T

Member Function Documentation

◆ begin() [1/2]

template<typename T , typename std::vector< T >::size_type reuse_threshold>
const_iterator wpi::UidVector< T, reuse_threshold >::begin ( ) const
inlinenoexcept

◆ begin() [2/2]

template<typename T , typename std::vector< T >::size_type reuse_threshold>
iterator wpi::UidVector< T, reuse_threshold >::begin ( )
inlinenoexcept

◆ cbegin()

template<typename T , typename std::vector< T >::size_type reuse_threshold>
const_iterator wpi::UidVector< T, reuse_threshold >::cbegin ( ) const
inlinenoexcept

◆ cend()

template<typename T , typename std::vector< T >::size_type reuse_threshold>
const_iterator wpi::UidVector< T, reuse_threshold >::cend ( ) const
inlinenoexcept

◆ clear()

template<typename T , typename std::vector< T >::size_type reuse_threshold>
void wpi::UidVector< T, reuse_threshold >::clear ( )
inlinenoexcept

Removes all elements.

◆ emplace_back()

template<typename T , typename std::vector< T >::size_type reuse_threshold>
template<class... Args>
size_type wpi::UidVector< T, reuse_threshold >::emplace_back ( Args &&...  args)
inline

◆ empty()

template<typename T , typename std::vector< T >::size_type reuse_threshold>
bool wpi::UidVector< T, reuse_threshold >::empty ( ) const
inlinenoexcept

◆ end() [1/2]

template<typename T , typename std::vector< T >::size_type reuse_threshold>
const_iterator wpi::UidVector< T, reuse_threshold >::end ( ) const
inlinenoexcept

◆ end() [2/2]

template<typename T , typename std::vector< T >::size_type reuse_threshold>
iterator wpi::UidVector< T, reuse_threshold >::end ( )
inlinenoexcept

◆ erase()

template<typename T , typename std::vector< T >::size_type reuse_threshold>
T wpi::UidVector< T, reuse_threshold >::erase ( size_type  uid)
inline

Removes the identified element by replacing it with a default-constructed one.

The element is added to the freelist for later reuse.

◆ operator[]() [1/2]

template<typename T , typename std::vector< T >::size_type reuse_threshold>
T & wpi::UidVector< T, reuse_threshold >::operator[] ( size_type  i)
inline

◆ operator[]() [2/2]

template<typename T , typename std::vector< T >::size_type reuse_threshold>
const T & wpi::UidVector< T, reuse_threshold >::operator[] ( size_type  i) const
inline

◆ size()

template<typename T , typename std::vector< T >::size_type reuse_threshold>
size_type wpi::UidVector< T, reuse_threshold >::size ( ) const
inlinenoexcept

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