41 typedef typename std::vector<T>::iterator
iterator;
49 Set(std::vector<T>& x) : _x(x)
60 {
return std::find(_x.begin(), _x.end(), x); }
64 {
return std::find(_x.begin(), _x.end(), x); }
79 template <
typename InputIt>
80 void insert(
const InputIt first,
const InputIt last)
82 for (InputIt position = first; position != last; ++position)
84 if (std::find(_x.begin(), _x.end(), *position) == _x.end())
85 _x.push_back(*position);
91 {
return _x.begin(); }
111 { std::sort(_x.begin(), _x.end()); }
122 const std::vector<T>&
set()
const
void clear()
Clear set.
Definition: Set.h:114
void erase(const T &x)
Erase an entry.
Definition: Set.h:102
~Set()
Destructor.
Definition: Set.h:56
std::size_t size() const
Set size.
Definition: Set.h:98
const_iterator find(const T &x) const
Find entry in set and return an iterator to the entry (const)
Definition: Set.h:63
const_iterator end() const
Iterator to beyond end of Set.
Definition: Set.h:94
std::vector< T >::const_iterator const_iterator
Const iterator.
Definition: Set.h:43
Set(const dolfin::Set< T > &x)
Copy constructor.
Definition: Set.h:53
Set()
Create empty set.
Definition: Set.h:46
Set(std::vector< T > &x)
Wrap std::vector as a set. Contents will be erased.
Definition: Set.h:49
std::vector< T > & set()
Return the vector that stores the data in the Set.
Definition: Set.h:126
std::vector< T >::iterator iterator
Iterator.
Definition: Set.h:41
const std::vector< T > & set() const
Return the vector that stores the data in the Set.
Definition: Set.h:122
const_iterator begin() const
Iterator to start of Set.
Definition: Set.h:90
void sort()
Sort set.
Definition: Set.h:110
T operator[](std::size_t n) const
Index the nth entry in the set.
Definition: Set.h:118
iterator find(const T &x)
Find entry in set and return an iterator to the entry.
Definition: Set.h:59
void insert(const InputIt first, const InputIt last)
Insert entries.
Definition: Set.h:80
bool insert(const T &x)
Insert entry.
Definition: Set.h:67