1 |
< |
#include <iostream> |
2 |
< |
#include <stdlib.h> |
1 |
> |
#include <utility> |
2 |
> |
#include "brains/Exclude.hpp" |
3 |
|
|
4 |
< |
#include "brains/Exclude.hpp" namespace oopse { |
4 |
> |
namespace oopse { |
5 |
|
|
6 |
– |
Exclude::Exclude() : |
7 |
– |
modified_(false) { } |
8 |
– |
|
9 |
– |
Exclude::~Exclude() { } |
10 |
– |
|
6 |
|
int *Exclude::getExcludeList() { |
7 |
|
|
8 |
|
if (modified_) { |
9 |
|
excludeList_.clear(); |
10 |
|
std::copy(excludeSet_.begin(), excludeSet_.end(), |
11 |
< |
std::back_inserter(excludeList_.end())); |
11 |
> |
std::back_inserter(excludeList_)); |
12 |
|
modified_ = false; |
13 |
|
} |
14 |
|
|
15 |
< |
return excludeList_.size() > 0 ? &excludeList_[0] : NULL; |
15 |
> |
return excludeList_.size() > 0 ? &(excludeList_[0].first) : NULL; |
16 |
|
} |
17 |
|
|
18 |
|
void Exclude::addPair(int i, int j) { |
27 |
|
std::swap(i, j); |
28 |
|
} |
29 |
|
|
30 |
< |
excludeSet_.insert(make_pair(i, j)); |
30 |
> |
excludeSet_.insert(std::make_pair(i, j)); |
31 |
|
modified_ = true; |
32 |
|
} |
33 |
|
} |
43 |
|
} |
44 |
|
} |
45 |
|
|
46 |
< |
std::set<std::pair<int, int>>::iterator Exclude::findPair(int i, int j) { |
46 |
> |
std::set<std::pair<int, int> >::iterator Exclude::findPair(int i, int j) { |
47 |
|
std::set<std::pair<int, int> >::iterator position; |
48 |
|
|
49 |
|
if (i != j) { |
50 |
< |
if (i < j) |
51 |
< |
position = excludeSet_.find(make_pair(i, j)); |
52 |
< |
else |
53 |
< |
position = excludeSet_.find(make_pair(j, i)); |
54 |
< |
|
55 |
< |
return excludeSet_.end; |
50 |
> |
if (i < j) { |
51 |
> |
position = excludeSet_.find(std::make_pair(i, j)); |
52 |
> |
} else { |
53 |
> |
position = excludeSet_.find(std::make_pair(j, i)); |
54 |
> |
} |
55 |
> |
return position; |
56 |
|
} else |
57 |
|
return excludeSet_.end(); |
58 |
|
} |