From 2c25bacd35149f2dae2b97ad6c078d1514241b0f Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 7 Feb 2017 09:32:20 -0800 Subject: [PATCH] Alias std::experimental::optional --- include/mapbox/geojsonvt/tile.hpp | 10 +++++----- include/mapbox/geojsonvt/types.hpp | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/mapbox/geojsonvt/tile.hpp b/include/mapbox/geojsonvt/tile.hpp index c94bb91..9acd3ff 100644 --- a/include/mapbox/geojsonvt/tile.hpp +++ b/include/mapbox/geojsonvt/tile.hpp @@ -95,23 +95,23 @@ class InternalTile { return true; } - void addFeature(const vt_point& point, const property_map& props, const std::experimental::optional& id) { + void addFeature(const vt_point& point, const property_map& props, const optional& id) { tile.features.push_back({ transform(point), props, id }); } - void addFeature(const vt_line_string& line, const property_map& props, const std::experimental::optional& id) { + void addFeature(const vt_line_string& line, const property_map& props, const optional& id) { const auto new_line = transform(line); if (!new_line.empty()) tile.features.push_back({ std::move(new_line), props, id }); } - void addFeature(const vt_polygon& polygon, const property_map& props, const std::experimental::optional& id) { + void addFeature(const vt_polygon& polygon, const property_map& props, const optional& id) { const auto new_polygon = transform(polygon); if (!new_polygon.empty()) tile.features.push_back({ std::move(new_polygon), props, id }); } - void addFeature(const vt_geometry_collection& collection, const property_map& props, const std::experimental::optional& id) { + void addFeature(const vt_geometry_collection& collection, const property_map& props, const optional& id) { for (const auto& geom : collection) { vt_geometry::visit(geom, [&](const auto& g) { // `this->` is a workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 @@ -121,7 +121,7 @@ class InternalTile { } template - void addFeature(const T& multi, const property_map& props, const std::experimental::optional& id) { + void addFeature(const T& multi, const property_map& props, const optional& id) { const auto new_multi = transform(multi); switch (new_multi.size()) { diff --git a/include/mapbox/geojsonvt/types.hpp b/include/mapbox/geojsonvt/types.hpp index fac89fb..b54357a 100644 --- a/include/mapbox/geojsonvt/types.hpp +++ b/include/mapbox/geojsonvt/types.hpp @@ -89,6 +89,9 @@ struct vt_geometry_collection : std::vector {}; using property_map = mapbox::geometry::property_map; using identifier = mapbox::geometry::identifier; +template +using optional = std::experimental::optional; + template struct vt_geometry_type; @@ -128,12 +131,12 @@ struct vt_geometry_type> { struct vt_feature { vt_geometry geometry; property_map properties; - std::experimental::optional id; + optional id; mapbox::geometry::box bbox = { { 2, 1 }, { -1, 0 } }; uint32_t num_points = 0; - vt_feature(const vt_geometry& geom, const property_map& props, const std::experimental::optional& id_) + vt_feature(const vt_geometry& geom, const property_map& props, const optional& id_) : geometry(geom), properties(props), id(id_) { mapbox::geometry::for_each_point(geom, [&](const vt_point& p) {