Skip to content

Commit 555f54b

Browse files
committed
replace boost iterator with C++ iterator and remove dependency
1 parent c123e69 commit 555f54b

5 files changed

Lines changed: 14 additions & 23 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ endif()
6060

6161
message(STATUS "Building in C++${CMAKE_CXX_STANDARD} mode")
6262

63-
find_package(Boost 1.66 REQUIRED COMPONENTS)
64-
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
65-
6663
# Modules without any Python code and just one source file.
6764
foreach(PYMOD geom index io area)
6865
pybind11_add_module(${PYMOD} lib/${PYMOD}.cc)

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ For other versions, a source wheel is provided. Make sure to install all
2828
external dependencies first. On Debian/Ubuntu-like systems, the following
2929
command installs all required packages:
3030

31-
sudo apt-get install build-essential cmake libboost-dev \
32-
libexpat1-dev zlib1g-dev libbz2-dev
31+
sudo apt-get install build-essential cmake libexpat1-dev zlib1g-dev libbz2-dev
3332

3433

3534
### Installing from source
@@ -45,16 +44,14 @@ pyosmium has the following dependencies:
4544
* [expat](https://libexpat.github.io/)
4645
* [libz](https://www.zlib.net/)
4746
* [libbz2](https://www.sourceware.org/bzip2/)
48-
* [Boost](https://www.boost.org/) variant and iterator >= 1.70
4947
* [Python Requests](https://docs.python-requests.org/)
5048
* [scikit-build-core](https://scikit-build-core.readthedocs.io)
5149
* a C++17-compatible compiler (Clang 13+, GCC 10+ are supported)
5250

5351

5452
### Compiling from Source
5553

56-
Make sure to install the development packages for expat, libz, libbz2
57-
and boost.
54+
Make sure to install the development packages for expat, libz and libbz2.
5855

5956
The appropriate versions for Libosmium and Protozero will be downloaded into
6057
the `contrib` directory when building the source package:

README.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ pyosmium can be installed with pip:
1717

1818
The Pypi source package already comes bundled with a matching version of
1919
libosmium, protozero and pybind11. Pyosmium additionally depends on
20-
expat, libz, libbz2 and Boost variant and iterator. You need to install
20+
expat, libz and libbz2. You need to install
2121
development packages for these libraries. On Debian/Ubuntu do::
2222

23-
sudo apt-get install build-essential cmake libboost-dev \
24-
libexpat1-dev zlib1g-dev libbz2-dev
23+
sudo apt-get install build-essential cmake libexpat1-dev zlib1g-dev libbz2-dev
2524

2625

2726
Python >= 3.8 is supported. Pypy is known not to work.

docs/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ the following additional dependencies need to be available:
2828
* [expat](https://libexpat.github.io/)
2929
* [libz](https://www.zlib.net/)
3030
* [libbz2](https://www.sourceware.org/bzip2/)
31-
* [Boost](https://www.boost.org/) variant and iterator >= 1.41
3231
* [Python Requests](https://docs.python-requests.org/en/master/)
3332
* a recent C++ compiler (Clang 3.4+, GCC 4.8+)
3433

@@ -41,7 +40,7 @@ of the build process:
4140
On Debian/Ubuntu-like systems, the following command installs all required
4241
packages:
4342

44-
sudo apt-get install python3-dev build-essential cmake libboost-dev \
43+
sudo apt-get install python3-dev build-essential cmake \
4544
libexpat1-dev zlib1g-dev libbz2-dev
4645

4746
Compatible versions of libosmium and protozero are shipped with the source

lib/merge_input_reader.cc

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
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

Comments
 (0)