@@ -70,20 +70,13 @@ DEALINGS IN THE SOFTWARE.
7070#include < algorithm>
7171#include < cassert>
7272#include < cstddef>
73+ #include < exception>
7374#include < iterator>
7475#include < memory>
7576#include < string>
7677#include < utility>
7778#include < vector>
7879
79- // MSVC doesn't support throw_with_nested yet
80- #ifdef _MSC_VER
81- # define THROW throw
82- #else
83- # include < exception>
84- # define THROW std::throw_with_nested
85- #endif
86-
8780namespace osmium {
8881
8982 struct geos_geometry_error : public geometry_error {
@@ -145,7 +138,7 @@ namespace osmium {
145138 try {
146139 return point_type{m_geos_factory->createPoint (geos::geom::Coordinate{xy.x , xy.y })};
147140 } catch (const geos::util::GEOSException& e) {
148- THROW (osmium::geos_geometry_error (e.what ()));
141+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
149142 }
150143 }
151144
@@ -155,23 +148,23 @@ namespace osmium {
155148 try {
156149 m_coordinate_sequence.reset (m_geos_factory->getCoordinateSequenceFactory ()->create (static_cast <std::size_t >(0 ), 2 ));
157150 } catch (const geos::util::GEOSException& e) {
158- THROW (osmium::geos_geometry_error (e.what ()));
151+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
159152 }
160153 }
161154
162155 void linestring_add_location (const osmium::geom::Coordinates& xy) {
163156 try {
164157 m_coordinate_sequence->add (geos::geom::Coordinate{xy.x , xy.y });
165158 } catch (const geos::util::GEOSException& e) {
166- THROW (osmium::geos_geometry_error (e.what ()));
159+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
167160 }
168161 }
169162
170163 linestring_type linestring_finish (std::size_t /* num_points */ ) {
171164 try {
172165 return linestring_type{m_geos_factory->createLineString (m_coordinate_sequence.release ())};
173166 } catch (const geos::util::GEOSException& e) {
174- THROW (osmium::geos_geometry_error (e.what ()));
167+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
175168 }
176169 }
177170
@@ -195,47 +188,47 @@ namespace osmium {
195188 m_polygons.emplace_back (m_geos_factory->createPolygon (m_rings[0 ].release (), inner_rings));
196189 m_rings.clear ();
197190 } catch (const geos::util::GEOSException& e) {
198- THROW (osmium::geos_geometry_error (e.what ()));
191+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
199192 }
200193 }
201194
202195 void multipolygon_outer_ring_start () {
203196 try {
204197 m_coordinate_sequence.reset (m_geos_factory->getCoordinateSequenceFactory ()->create (static_cast <std::size_t >(0 ), 2 ));
205198 } catch (const geos::util::GEOSException& e) {
206- THROW (osmium::geos_geometry_error (e.what ()));
199+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
207200 }
208201 }
209202
210203 void multipolygon_outer_ring_finish () {
211204 try {
212205 m_rings.emplace_back (m_geos_factory->createLinearRing (m_coordinate_sequence.release ()));
213206 } catch (const geos::util::GEOSException& e) {
214- THROW (osmium::geos_geometry_error (e.what ()));
207+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
215208 }
216209 }
217210
218211 void multipolygon_inner_ring_start () {
219212 try {
220213 m_coordinate_sequence.reset (m_geos_factory->getCoordinateSequenceFactory ()->create (static_cast <std::size_t >(0 ), 2 ));
221214 } catch (const geos::util::GEOSException& e) {
222- THROW (osmium::geos_geometry_error (e.what ()));
215+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
223216 }
224217 }
225218
226219 void multipolygon_inner_ring_finish () {
227220 try {
228221 m_rings.emplace_back (m_geos_factory->createLinearRing (m_coordinate_sequence.release ()));
229222 } catch (const geos::util::GEOSException& e) {
230- THROW (osmium::geos_geometry_error (e.what ()));
223+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
231224 }
232225 }
233226
234227 void multipolygon_add_location (const osmium::geom::Coordinates& xy) {
235228 try {
236229 m_coordinate_sequence->add (geos::geom::Coordinate{xy.x , xy.y });
237230 } catch (const geos::util::GEOSException& e) {
238- THROW (osmium::geos_geometry_error (e.what ()));
231+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
239232 }
240233 }
241234
@@ -248,7 +241,7 @@ namespace osmium {
248241 m_polygons.clear ();
249242 return multipolygon_type{m_geos_factory->createMultiPolygon (polygons)};
250243 } catch (const geos::util::GEOSException& e) {
251- THROW (osmium::geos_geometry_error (e.what ()));
244+ std::throw_with_nested (osmium::geos_geometry_error (e.what ()));
252245 }
253246 }
254247
@@ -264,8 +257,6 @@ namespace osmium {
264257
265258} // namespace osmium
266259
267- #undef THROW
268-
269260#endif
270261
271262#endif // OSMIUM_GEOM_GEOS_HPP
0 commit comments