Skip to content

Commit f3a11bf

Browse files
committed
Use std::back_inserter instead of boost::function_output_iterator
1 parent d40c8ef commit f3a11bf

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/command_apply_changes.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
4343
#include <osmium/util/verbose_output.hpp>
4444
#include <osmium/visitor.hpp>
4545

46-
#include <boost/function_output_iterator.hpp>
4746
#include <boost/program_options.hpp>
4847

4948
#include <algorithm>
49+
#include <iterator>
5050
#include <stdexcept>
5151
#include <string>
5252
#include <utility>
@@ -155,9 +155,6 @@ namespace {
155155
/**
156156
* Copy the first OSM object with a given Id to the output. Keep
157157
* track of the Id of each object to do this.
158-
*
159-
* We are using this functor class instead of a simple lambda, because the
160-
* lambda doesn't build on MSVC.
161158
*/
162159
class copy_first_with_id {
163160

@@ -166,11 +163,15 @@ class copy_first_with_id {
166163

167164
public:
168165

166+
using iterator_category = std::output_iterator_tag;
167+
using value_type = const osmium::OSMObject;
168+
using reference = const osmium::OSMObject&;
169+
169170
explicit copy_first_with_id(osmium::io::Writer* w) :
170171
writer(w) {
171172
}
172173

173-
void operator()(const osmium::OSMObject& obj) {
174+
void push_back(const osmium::OSMObject& obj) {
174175
if (obj.id() != id) {
175176
if (obj.visible()) {
176177
(*writer)(obj);
@@ -355,7 +356,8 @@ bool CommandApplyChanges::run() {
355356
} else {
356357
m_vout << "Applying changes and writing them to output...\n";
357358
const auto input = osmium::io::make_input_iterator_range<osmium::OSMObject>(reader);
358-
auto output_it = boost::make_function_output_iterator(copy_first_with_id(&writer));
359+
copy_first_with_id copy_first{&writer};
360+
auto output_it = std::back_inserter(copy_first);
359361

360362
std::set_union(objects.begin(),
361363
objects.end(),

0 commit comments

Comments
 (0)