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:

Set<int> A = Set<int>(1) + Set<int>(2) + Set<int>(3);
Set<int> B = Set<int>(1) + Set<int>(2);
Set<int> C = Set<int>(1) + Set<int>(2) + Set<int>(4);
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

#include <Set.h>

Public Types

typedef std::set< T >::value_type value_type
 
typedef std::set< T >::const_iterator const_iterator
 
typedef std::set< T >::iterator iterator
 

Public Member Functions

 Set ()
 
 Set (const T &element)
 
virtual ~Set ()
 
std::pair< iterator, bool > insert (const T &element)
 
iterator insert (iterator position, const T &element)
 
template<class InputIterator >
void insert (InputIterator first, InputIterator last)
 
const Set< T > & operator&= (const Set< T > &set)
 intersection More...
 
const Set< T > & operator+= (const Set< T > &set)
 union More...
 
const Set< T > & operator-= (const Set< T > &set)
 difference / relative complement More...
 
size_t size () const
 
void swap (Set< T > &set)
 
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_
 

Member Typedef Documentation

◆ const_iterator

template<typename T >
typedef std::set<T>::const_iterator walberla::Set< T >::const_iterator

◆ iterator

template<typename T >
typedef std::set<T>::iterator walberla::Set< T >::iterator

◆ value_type

template<typename T >
typedef std::set<T>::value_type walberla::Set< T >::value_type

Constructor & Destructor Documentation

◆ Set() [1/2]

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

◆ Set() [2/2]

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

◆ ~Set()

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

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

◆ 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

◆ 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

◆ 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.

◆ size()

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

◆ swap()

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

◆ toStream()

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

◆ toString()

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

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:
@ B
Bottom.
Definition: Directions.h:51
@ C
Center.
Definition: Directions.h:45