diff --git a/src/mapnik_image.cpp b/src/mapnik_image.cpp index 9add692c9..488427b56 100644 --- a/src/mapnik_image.cpp +++ b/src/mapnik_image.cpp @@ -230,7 +230,7 @@ unsigned get_type(mapnik::image_any & im) std::shared_ptr open_from_file(std::string const& filename) { - boost::optional type = type_from_filename(filename); + auto type = type_from_filename(filename); if (type) { std::unique_ptr reader(get_image_reader(filename,*type)); diff --git a/src/mapnik_layer.cpp b/src/mapnik_layer.cpp index 4fc7ea579..fbd277a81 100644 --- a/src/mapnik_layer.cpp +++ b/src/mapnik_layer.cpp @@ -95,7 +95,7 @@ struct layer_pickle_suite : boost::python::pickle_suite std::vector & (mapnik::layer::*_styles_)() = &mapnik::layer::styles; -void set_maximum_extent(mapnik::layer & l, boost::optional > const& box) +void set_maximum_extent(mapnik::layer & l, std::optional > const& box) { if (box) { @@ -107,7 +107,7 @@ void set_maximum_extent(mapnik::layer & l, boost::optional } } -void set_buffer_size(mapnik::layer & l, boost::optional const& buffer_size) +void set_buffer_size(mapnik::layer & l, std::optional const& buffer_size) { if (buffer_size) { @@ -121,7 +121,7 @@ void set_buffer_size(mapnik::layer & l, boost::optional const& buffer_size) PyObject * get_buffer_size(mapnik::layer & l) { - boost::optional buffer_size = l.buffer_size(); + std::optional buffer_size = l.buffer_size(); if (buffer_size) { #if PY_VERSION_HEX >= 0x03000000 diff --git a/src/mapnik_map.cpp b/src/mapnik_map.cpp index 3587e5d8a..cfa523b03 100644 --- a/src/mapnik_map.cpp +++ b/src/mapnik_map.cpp @@ -105,7 +105,7 @@ mapnik::featureset_ptr query_map_point(mapnik::Map const& m, int index, double x return m.query_map_point(idx, x, y); } -void set_maximum_extent(mapnik::Map & m, boost::optional > const& box) +void set_maximum_extent(mapnik::Map & m, std::optional > const& box) { if (box) { diff --git a/src/python_optional.hpp b/src/python_optional.hpp index d690b7c51..9d86c340e 100644 --- a/src/python_optional.hpp +++ b/src/python_optional.hpp @@ -28,7 +28,7 @@ #include #pragma GCC diagnostic pop -// boost::optional to/from converter from John Wiegley +// std::optional to/from converter from John Wiegley template struct object_from_python @@ -54,7 +54,7 @@ struct python_optional : public mapnik::util::noncopyable { struct optional_to_python { - static PyObject * convert(const boost::optional& value) + static PyObject * convert(const std::optional& value) { return (value ? boost::python::to_python_value()(*value) : boost::python::detail::none()); @@ -90,9 +90,9 @@ struct python_optional : public mapnik::util::noncopyable data)->storage.bytes; if (data->convertible == source) // == None - new (storage) boost::optional(); // A Boost uninitialized value + new (storage) std::optional(); // A Boost uninitialized value else - new (storage) boost::optional(*static_cast(data->convertible)); + new (storage) std::optional(*static_cast(data->convertible)); data->convertible = storage; } @@ -100,18 +100,18 @@ struct python_optional : public mapnik::util::noncopyable explicit python_optional() { - register_python_conversion, + register_python_conversion, optional_to_python, optional_from_python>(); } }; -// to/from boost::optional +// to/from std::optional template <> struct python_optional : public mapnik::util::noncopyable { struct optional_to_python { - static PyObject * convert(const boost::optional& value) + static PyObject * convert(const std::optional& value) { return (value ? PyFloat_FromDouble(*value) : boost::python::detail::none()); @@ -133,30 +133,30 @@ struct python_optional : public mapnik::util::noncopyable boost::python::converter::rvalue_from_python_stage1_data * data) { using namespace boost::python::converter; - void * const storage = ((rvalue_from_python_storage > *) + void * const storage = ((rvalue_from_python_storage > *) data)->storage.bytes; if (source == Py_None) // == None - new (storage) boost::optional(); // A Boost uninitialized value + new (storage) std::optional(); // A Boost uninitialized value else - new (storage) boost::optional(PyFloat_AsDouble(source)); + new (storage) std::optional(PyFloat_AsDouble(source)); data->convertible = storage; } }; explicit python_optional() { - register_python_conversion, + register_python_conversion, optional_to_python, optional_from_python>(); } }; -// to/from boost::optional +// to/from std::optional template <> struct python_optional : public mapnik::util::noncopyable { struct optional_to_python { - static PyObject * convert(const boost::optional& value) + static PyObject * convert(const std::optional& value) { if (value) { @@ -181,13 +181,13 @@ struct python_optional : public mapnik::util::noncopyable boost::python::converter::rvalue_from_python_stage1_data * data) { using namespace boost::python::converter; - void * const storage = ((rvalue_from_python_storage > *) + void * const storage = ((rvalue_from_python_storage > *) data)->storage.bytes; if (source == Py_None) // == None - new (storage) boost::optional(); // A Boost uninitialized value + new (storage) std::optional(); // A Boost uninitialized value else { - new (storage) boost::optional(source == Py_True ? true : false); + new (storage) std::optional(source == Py_True ? true : false); } data->convertible = storage; } @@ -195,7 +195,7 @@ struct python_optional : public mapnik::util::noncopyable explicit python_optional() { - register_python_conversion, + register_python_conversion, optional_to_python, optional_from_python>(); } };