WPILibC++ 2024.3.1
wpi::SmallSet< T, N, C > Class Template Reference

SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less than N). More...

#include </home/runner/work/allwpilib/allwpilib/wpiutil/src/main/native/thirdparty/llvm/include/wpi/SmallSet.h>

Public Types

using key_type = T
 
using size_type = size_t
 
using value_type = T
 
using const_iterator = SmallSetIterator< T, N, C >
 

Public Member Functions

 SmallSet ()=default
 
bool empty () const
 
size_type size () const
 
size_type count (const T &V) const
 count - Return 1 if the element is in the set, 0 otherwise. More...
 
std::pair< const_iterator, bool > insert (const T &V)
 insert - Insert an element into the set if it isn't already there. More...
 
template<typename IterT >
void insert (IterT I, IterT E)
 
bool erase (const T &V)
 
void clear ()
 
const_iterator begin () const
 
const_iterator end () const
 
bool contains (const T &V) const
 Check if the SmallSet contains the given element. More...
 

Detailed Description

template<typename T, unsigned N, typename C = std::less<T>>
class wpi::SmallSet< T, N, C >

SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less than N).

In this case, the set can be maintained with no mallocs. If the set gets large, we expand to using an std::set to maintain reasonable lookup times.

Member Typedef Documentation

◆ const_iterator

template<typename T , unsigned N, typename C = std::less<T>>
using wpi::SmallSet< T, N, C >::const_iterator = SmallSetIterator<T, N, C>

◆ key_type

template<typename T , unsigned N, typename C = std::less<T>>
using wpi::SmallSet< T, N, C >::key_type = T

◆ size_type

template<typename T , unsigned N, typename C = std::less<T>>
using wpi::SmallSet< T, N, C >::size_type = size_t

◆ value_type

template<typename T , unsigned N, typename C = std::less<T>>
using wpi::SmallSet< T, N, C >::value_type = T

Constructor & Destructor Documentation

◆ SmallSet()

template<typename T , unsigned N, typename C = std::less<T>>
wpi::SmallSet< T, N, C >::SmallSet ( )
default

Member Function Documentation

◆ begin()

template<typename T , unsigned N, typename C = std::less<T>>
const_iterator wpi::SmallSet< T, N, C >::begin ( ) const
inline

◆ clear()

template<typename T , unsigned N, typename C = std::less<T>>
void wpi::SmallSet< T, N, C >::clear ( )
inline

◆ contains()

template<typename T , unsigned N, typename C = std::less<T>>
bool wpi::SmallSet< T, N, C >::contains ( const T &  V) const
inline

Check if the SmallSet contains the given element.

◆ count()

template<typename T , unsigned N, typename C = std::less<T>>
size_type wpi::SmallSet< T, N, C >::count ( const T &  V) const
inline

count - Return 1 if the element is in the set, 0 otherwise.

◆ empty()

template<typename T , unsigned N, typename C = std::less<T>>
bool wpi::SmallSet< T, N, C >::empty ( ) const
inline

◆ end()

template<typename T , unsigned N, typename C = std::less<T>>
const_iterator wpi::SmallSet< T, N, C >::end ( ) const
inline

◆ erase()

template<typename T , unsigned N, typename C = std::less<T>>
bool wpi::SmallSet< T, N, C >::erase ( const T &  V)
inline

◆ insert() [1/2]

template<typename T , unsigned N, typename C = std::less<T>>
std::pair< const_iterator, bool > wpi::SmallSet< T, N, C >::insert ( const T &  V)
inline

insert - Insert an element into the set if it isn't already there.

Returns a pair. The first value of it is an iterator to the inserted element or the existing element in the set. The second value is true if the element is inserted (it was not in the set before).

◆ insert() [2/2]

template<typename T , unsigned N, typename C = std::less<T>>
template<typename IterT >
void wpi::SmallSet< T, N, C >::insert ( IterT  I,
IterT  E 
)
inline

◆ size()

template<typename T , unsigned N, typename C = std::less<T>>
size_type wpi::SmallSet< T, N, C >::size ( ) const
inline

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