Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parser
src
Teuchos_set.hpp
1
#ifndef TEUCHOS_SET_HPP
2
#define TEUCHOS_SET_HPP
3
4
#include <set>
5
#include <iosfwd>
6
#include <Teuchos_Assert.hpp>
7
8
namespace
Teuchos
{
9
10
template
<
typename
T>
11
void
unite_with(std::set<T>& a, std::set<T>
const
& b) {
12
for
(
typename
std::set<T>::const_iterator it = b.begin(); it != b.end(); ++it) {
13
const
T& x = *it;
14
a.insert(x);
15
}
16
}
17
18
template
<
typename
T>
19
void
unite(std::set<T>& result, std::set<T>
const
& a, std::set<T>
const
& b) {
20
result = a;
21
unite_with(result, b);
22
}
23
24
template
<
typename
T>
25
void
subtract_from(std::set<T>& a, std::set<T>
const
& b) {
26
for
(
typename
std::set<T>::const_iterator it = b.begin(); it != b.end(); ++it) {
27
const
T& x = *it;
28
typename
std::set<T>::iterator it2 = a.find(x);
29
if
(it2 == a.end())
continue
;
30
a.erase(it2);
31
}
32
}
33
34
template
<
typename
T>
35
bool
intersects(std::set<T>
const
& a, std::set<T>
const
& b) {
36
for
(
typename
std::set<T>::const_iterator it = b.begin(); it != b.end(); ++it) {
37
const
T& x = *it;
38
typename
std::set<T>::const_iterator it2 = a.find(x);
39
if
(it2 != a.end())
return
true
;
40
}
41
return
false
;
42
}
43
44
}
45
46
#endif
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0