Skip to content

Commit dbf6c1a

Browse files
committed
Remove dependency on Boost
1 parent c40f6bd commit dbf6c1a

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

.github/actions/install-macos/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ runs:
66
- name: Install homebrew packages
77
run: |
88
brew install \
9-
boost \
109
fmt \
1110
gdal
1211
shell: bash

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ jobs:
9797
cmake \
9898
g++ \
9999
git \
100-
libboost-dev \
101100
libbz2-dev \
102101
libexpat1-dev \
103102
libfmt-dev \
@@ -115,7 +114,6 @@ jobs:
115114
if: startsWith(matrix.image, 'fedora:')
116115
run: |
117116
dnf install --quiet --assumeyes \
118-
boost-devel \
119117
bzip2-devel \
120118
cmake \
121119
expat-devel \

src/osp-find-multipolygon-problems.cpp

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include <osmium/util/verbose_output.hpp>
1818
#include <osmium/visitor.hpp>
1919

20-
#include <boost/iterator/filter_iterator.hpp>
21-
2220
#include <algorithm>
2321
#include <cstdlib>
2422
#include <cstring>
@@ -69,27 +67,38 @@ class CheckMPManager
6967
[[nodiscard]] bool compare_tags(osmium::TagList const &rtags,
7068
osmium::TagList const &wtags) const
7169
{
72-
auto const d =
73-
std::count_if(wtags.cbegin(), wtags.cend(), std::cref(m_filter));
74-
if (d > 0) {
75-
using iterator =
76-
boost::filter_iterator<MPFilter,
77-
osmium::TagList::const_iterator>;
78-
iterator const rfi_begin{std::cref(m_filter), rtags.cbegin(),
79-
rtags.cend()};
80-
iterator const rfi_end{std::cref(m_filter), rtags.cend(),
81-
rtags.cend()};
82-
iterator const wfi_begin{std::cref(m_filter), wtags.cbegin(),
83-
wtags.cend()};
84-
iterator const wfi_end{std::cref(m_filter), wtags.cend(),
85-
wtags.cend()};
86-
87-
if (std::equal(wfi_begin, wfi_end, rfi_begin) &&
88-
d == std::distance(rfi_begin, rfi_end)) {
89-
return true;
70+
auto const rend = rtags.cend();
71+
auto const wend = wtags.cend();
72+
73+
auto rit = rtags.cbegin();
74+
auto wit = wtags.cbegin();
75+
76+
while (rit != rend && wit != wend) {
77+
if (!m_filter(*rit)) {
78+
++rit;
79+
continue;
9080
}
81+
if (!m_filter(*wit)) {
82+
++wit;
83+
continue;
84+
}
85+
if (*rit == *wit) {
86+
++rit;
87+
++wit;
88+
continue;
89+
}
90+
return false;
9191
}
92-
return false;
92+
93+
while (rit != rend && !m_filter(*rit)) {
94+
++rit;
95+
}
96+
97+
while (wit != wend && !m_filter(*wit)) {
98+
++wit;
99+
}
100+
101+
return rit == rend && wit == wend;
93102
}
94103

95104
public:

0 commit comments

Comments
 (0)