21 #ifndef __DOLFIN_SET_H 22 #define __DOLFIN_SET_H 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); }
63 const_iterator
find(
const T& x)
const 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(); }
94 const_iterator
end()
const 104 iterator p =
find(x);
111 { std::sort(_x.begin(), _x.end()); }
122 const std::vector<T>&
set()
const 126 std::vector<T>&
set()
Set()
Create empty set.
Definition: Set.h:46
std::vector< T >::const_iterator const_iterator
Const iterator.
Definition: Set.h:43
std::vector< T >::iterator iterator
Iterator.
Definition: Set.h:41
std::size_t size() const
Set size.
Definition: Set.h:98
void insert(const InputIt first, const InputIt last)
Insert entries.
Definition: Set.h:80
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
Set(std::vector< T > &x)
Wrap std::vector as a set. Contents will be erased.
Definition: Set.h:49
const_iterator end() const
Iterator to beyond end of Set.
Definition: Set.h:94
~Set()
Destructor.
Definition: Set.h:56
Set(const dolfin::Set< T > &x)
Copy constructor.
Definition: Set.h:53
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 begin() const
Iterator to start of Set.
Definition: Set.h:90
void erase(const T &x)
Erase an entry.
Definition: Set.h:102
bool insert(const T &x)
Insert entry.
Definition: Set.h:67
void clear()
Clear set.
Definition: Set.h:114
iterator find(const T &x)
Find entry in set and return an iterator to the entry.
Definition: Set.h:59