waLBerla 7.2
Loading...
Searching...
No Matches
walberla::Set< T > Class Template Reference

Detailed Description

template<typename T>
class walberla::Set< T >

Wrapper class for managing sets that store elements of type T.

If the equality of two sets must be tested, the operators "==" and "!=" and the member function "isEqual" can be used. If two sets must be compared in terms of size, the operators "<", ">", "<=", and ">=" and the member function "equalSize" can be used:

bool boolean = ( A == B ); // -> false
boolean = ( A != B ); // -> true
boolean = ( A > B ); // -> true
boolean = ( A >= B ); // -> true
boolean = ( A < B ); // -> false
boolean = A.equalSize(B); // -> false
boolean = ( A == C ); // -> false
boolean = A.equalSize(C); // -> true
B.insert(3);
boolean = ( A == B ); // -> true
boolean = A.equalSize(B); // -> true
boolean = ( A > B ); // -> false
boolean = ( A >= B ); // -> true
boolean = ( A <= B ); // -> true
Wrapper class for managing sets that store elements of type T.
Definition Set.h:85
bool equalSize(const Set< T > &set) const
compares the size (not the content!) of two sets
Definition Set.h:121
Set()=default

#include <Set.h>

Public Types

using value_type = typename std::set<T>::value_type
 
using const_iterator = typename std::set<T>::const_iterator
 
using iterator = typename std::set<T>::iterator
 

Public Member Functions

 Set ()=default
 
 Set (const T &element)
 
virtual ~Set ()=default
 
std::pair< iterator, bool > insert (const T &element)
 
iterator insert (iterator position, const T &element)
 
template<class InputIterator >
void insert (InputIterator first, InputIterator last)
 
void clear ()
 removes all elements from this set
 
const Set< T > & operator&= (const Set< T > &set)
 intersection
 
const Set< T > & operator+= (const Set< T > &set)
 union
 
const Set< T > & operator-= (const Set< T > &set)
 difference / relative complement
 
bool operator< (const Set< T > &set) const
 compares the size (not the content!) of two sets
 
bool operator> (const Set< T > &set) const
 compares the size (not the content!) of two sets
 
bool operator<= (const Set< T > &set) const
 compares the size (not the content!) of two sets
 
bool operator>= (const Set< T > &set) const
 compares the size (not the content!) of two sets
 
bool equalSize (const Set< T > &set) const
 compares the size (not the content!) of two sets
 
bool intersects (const Set< T > &set) const
 true if both sets intersect
 
bool contains (const Set< T > &set) const
 true if "set" is completely contained within this set
 
bool contains (const T &element) const
 true if "element" is contained within this set
 
bool isEqual (const Set< T > &set) const
 true if both sets contain the same elements
 
bool empty () const
 true if this set is empty
 
bool isEmpty () const
 true if this set is empty
 
size_t size () const
 
void swap (Set< T > &set) noexcept
 
void toStream (std::ostream &os) const
 
std::string toString () const
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
const std::set< T > & get () const
 
std::set< T > & get ()
 

Static Public Member Functions

static const Set< T > emptySet ()
 

Private Attributes

std::set< T > set_
 

Friends

Set< T > operator& (const Set &a, const Set &b)
 intersection
 
Set< T > operator+ (const Set &a, const Set &b)
 union
 
Set< T > operator- (const Set &a, const Set &b)
 difference / relative complement
 
bool operator== (const Set &a, const Set &b)
 compares the content of two sets
 
bool operator!= (const Set &a, const Set &b)
 compares the content of two sets
 

Member Typedef Documentation

◆ const_iterator

template<typename T >
using walberla::Set< T >::const_iterator = typename std::set<T>::const_iterator

◆ iterator

template<typename T >
using walberla::Set< T >::iterator = typename std::set<T>::iterator

◆ value_type

template<typename T >
using walberla::Set< T >::value_type = typename std::set<T>::value_type

Constructor & Destructor Documentation

◆ Set() [1/2]

template<typename T >
walberla::Set< T >::Set ( )
inlinedefault

◆ Set() [2/2]

template<typename T >
walberla::Set< T >::Set ( const T & element)
inline

◆ ~Set()

template<typename T >
virtual walberla::Set< T >::~Set ( )
inlinevirtualdefault

Member Function Documentation

◆ begin() [1/2]

template<typename T >
iterator walberla::Set< T >::begin ( )
inline

◆ begin() [2/2]

template<typename T >
const_iterator walberla::Set< T >::begin ( ) const
inline

◆ clear()

template<typename T >
void walberla::Set< T >::clear ( )
inline

removes all elements from this set

◆ contains() [1/2]

template<typename T >
bool walberla::Set< T >::contains ( const Set< T > & set) const
inline

true if "set" is completely contained within this set

◆ contains() [2/2]

template<typename T >
bool walberla::Set< T >::contains ( const T & element) const
inline

true if "element" is contained within this set

◆ empty()

template<typename T >
bool walberla::Set< T >::empty ( ) const
inline

true if this set is empty

◆ emptySet()

template<typename T >
static const Set< T > walberla::Set< T >::emptySet ( )
inlinestatic

◆ end() [1/2]

template<typename T >
iterator walberla::Set< T >::end ( )
inline

◆ end() [2/2]

template<typename T >
const_iterator walberla::Set< T >::end ( ) const
inline

◆ equalSize()

template<typename T >
bool walberla::Set< T >::equalSize ( const Set< T > & set) const
inline

compares the size (not the content!) of two sets

◆ get() [1/2]

template<typename T >
std::set< T > & walberla::Set< T >::get ( )
inline

◆ get() [2/2]

template<typename T >
const std::set< T > & walberla::Set< T >::get ( ) const
inline

◆ insert() [1/3]

template<typename T >
std::pair< iterator, bool > walberla::Set< T >::insert ( const T & element)
inline

◆ insert() [2/3]

template<typename T >
template<class InputIterator >
void walberla::Set< T >::insert ( InputIterator first,
InputIterator last )
inline

◆ insert() [3/3]

template<typename T >
iterator walberla::Set< T >::insert ( iterator position,
const T & element )
inline

◆ intersects()

template<typename T >
bool walberla::Set< T >::intersects ( const Set< T > & set) const
inline

true if both sets intersect

◆ isEmpty()

template<typename T >
bool walberla::Set< T >::isEmpty ( ) const
inline

true if this set is empty

◆ isEqual()

template<typename T >
bool walberla::Set< T >::isEqual ( const Set< T > & set) const
inline

true if both sets contain the same elements

◆ operator&=()

template<typename T >
const Set< T > & walberla::Set< T >::operator&= ( const Set< T > & set)
inline

intersection

Calculates the intersection of "this" and "set", only the resulting set is kept.

◆ operator+=()

template<typename T >
const Set< T > & walberla::Set< T >::operator+= ( const Set< T > & set)
inline

union

Calculates the union of "this" and "set", only the resulting set is kept.

◆ operator-=()

template<typename T >
const Set< T > & walberla::Set< T >::operator-= ( const Set< T > & set)
inline

difference / relative complement

Calculates the difference of "this" and "set", only the resulting set (result = this - set) is kept.

◆ operator<()

template<typename T >
bool walberla::Set< T >::operator< ( const Set< T > & set) const
inline

compares the size (not the content!) of two sets

◆ operator<=()

template<typename T >
bool walberla::Set< T >::operator<= ( const Set< T > & set) const
inline

compares the size (not the content!) of two sets

◆ operator>()

template<typename T >
bool walberla::Set< T >::operator> ( const Set< T > & set) const
inline

compares the size (not the content!) of two sets

◆ operator>=()

template<typename T >
bool walberla::Set< T >::operator>= ( const Set< T > & set) const
inline

compares the size (not the content!) of two sets

◆ size()

template<typename T >
size_t walberla::Set< T >::size ( ) const
inline

◆ swap()

template<typename T >
void walberla::Set< T >::swap ( Set< T > & set)
inlinenoexcept

◆ toStream()

template<typename T >
void walberla::Set< T >::toStream ( std::ostream & os) const

◆ toString()

template<typename T >
std::string walberla::Set< T >::toString ( ) const
inline

Friends And Related Symbol Documentation

◆ operator!=

template<typename T >
bool operator!= ( const Set< T > & a,
const Set< T > & b )
friend

compares the content of two sets

◆ operator&

template<typename T >
Set< T > operator& ( const Set< T > & a,
const Set< T > & b )
friend

intersection

◆ operator+

template<typename T >
Set< T > operator+ ( const Set< T > & a,
const Set< T > & b )
friend

union

◆ operator-

template<typename T >
Set< T > operator- ( const Set< T > & a,
const Set< T > & b )
friend

difference / relative complement

◆ operator==

template<typename T >
bool operator== ( const Set< T > & a,
const Set< T > & b )
friend

compares the content of two sets

Member Data Documentation

◆ set_

template<typename T >
std::set<T> walberla::Set< T >::set_
private

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