22 *
33 * This file is part of pyosmium. (https://osmcode.org/pyosmium/)
44 *
5- * Copyright (C) 2025 Sarah Hoffmann <lonvia@denofr.de> and others.
5+ * Copyright (C) 2026 Sarah Hoffmann <lonvia@denofr.de> and others.
66 * For a full list of authors see the git log.
77 */
88#include < pybind11/pybind11.h>
99
1010#include < vector>
11-
12- #include < boost/iterator/function_output_iterator.hpp>
11+ #include < iterator>
1312
1413#include < osmium/osm/object_comparisons.hpp>
1514#include < osmium/io/any_input.hpp>
@@ -30,20 +29,21 @@ namespace {
3029 /* *
3130 * Copy the first OSM object with a given Id to the output. Keep
3231 * track of the Id of each object to do this.
33- *
34- * We are using this functor class instead of a simple lambda, because the
35- * lambda doesn't build on MSVC.
3632 */
3733 class copy_first_with_id {
3834 osmium::io::Writer* writer;
3935 osmium::object_id_type id = 0 ;
4036
4137 public:
38+ using iterator_category = std::output_iterator_tag;
39+ using value_type = const osmium::OSMObject;
40+ using reference = const osmium::OSMObject&;
41+
4242 explicit copy_first_with_id (osmium::io::Writer& w) :
4343 writer(&w) {
4444 }
4545
46- void operator () (const osmium::OSMObject& obj) {
46+ void push_back (const osmium::OSMObject& obj) {
4747 if (obj.id () != id) {
4848 if (obj.visible ()) {
4949 (*writer)(obj);
@@ -112,9 +112,8 @@ class MergeInputReader
112112 std::reverse (objects.ptr_begin (), objects.ptr_end ());
113113 objects.sort (osmium::object_order_type_id_reverse_version ());
114114
115- auto output_it = boost::make_function_output_iterator (
116- copy_first_with_id (*writer.get ())
117- );
115+ copy_first_with_id copy_first{*writer.get ()};
116+ auto output_it = std::back_inserter (copy_first);
118117
119118 std::set_union (objects.begin (),
120119 objects.end (),
0 commit comments