Empirical
Public Types | Public Member Functions | List of all members
emp::ra_set< T > Class Template Reference

#include <ra_set.h>

Public Types

using value_type = T
 

Public Member Functions

 ra_set ()
 
 ra_set (const ra_set &)=default
 
 ra_set (ra_set &&)=default
 
ra_set< T > & operator= (const ra_set &)=default
 
ra_set< T > & operator= (ra_set &&)=default
 
bool empty () const
 Are there any values in this ra_set? More...
 
size_t size () const
 How many elements are in this set? More...
 
const T & operator[] (size_t pos) const
 Index into the ra_set, similar to a vector. More...
 
void clear ()
 Remove all values from this container. More...
 
void insert (const T &v)
 Insert a new value into container. More...
 
bool erase (const T &v)
 Erase a specific value from the container. More...
 
size_t count (const T &v) const
 Count the number of times a particular value in in the container (0 or 1). More...
 

Detailed Description

template<typename T>
class emp::ra_set< T >

This class uses a combination of a hashtable (std::unordered_map) and emp::vector to lookup insert, lookup, and delete values in constant time, while still being able to step through all values (albeit in an arbitrary order).

Note
The arbitrary order of values may change if any values are deleted.

Member Typedef Documentation

template<typename T >
using emp::ra_set< T >::value_type = T

Constructor & Destructor Documentation

template<typename T >
emp::ra_set< T >::ra_set ( )
inline
template<typename T >
emp::ra_set< T >::ra_set ( const ra_set< T > &  )
default
template<typename T >
emp::ra_set< T >::ra_set ( ra_set< T > &&  )
default

Member Function Documentation

template<typename T >
void emp::ra_set< T >::clear ( )
inline

Remove all values from this container.

template<typename T >
size_t emp::ra_set< T >::count ( const T &  v) const
inline

Count the number of times a particular value in in the container (0 or 1).

template<typename T >
bool emp::ra_set< T >::empty ( ) const
inline

Are there any values in this ra_set?

template<typename T >
bool emp::ra_set< T >::erase ( const T &  v)
inline

Erase a specific value from the container.

template<typename T >
void emp::ra_set< T >::insert ( const T &  v)
inline

Insert a new value into container.

template<typename T >
ra_set<T>& emp::ra_set< T >::operator= ( const ra_set< T > &  )
default
template<typename T >
ra_set<T>& emp::ra_set< T >::operator= ( ra_set< T > &&  )
default
template<typename T >
const T& emp::ra_set< T >::operator[] ( size_t  pos) const
inline

Index into the ra_set, similar to a vector.

template<typename T >
size_t emp::ra_set< T >::size ( ) const
inline

How many elements are in this set?


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