Skip to content

Commit

Permalink
Alias std::experimental::optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Feb 7, 2017
1 parent 7d50bfc commit 2c25bac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions include/mapbox/geojsonvt/tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,23 @@ class InternalTile {
return true;
}

void addFeature(const vt_point& point, const property_map& props, const std::experimental::optional<identifier>& id) {
void addFeature(const vt_point& point, const property_map& props, const optional<identifier>& id) {
tile.features.push_back({ transform(point), props, id });
}

void addFeature(const vt_line_string& line, const property_map& props, const std::experimental::optional<identifier>& id) {
void addFeature(const vt_line_string& line, const property_map& props, const optional<identifier>& 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<identifier>& id) {
void addFeature(const vt_polygon& polygon, const property_map& props, const optional<identifier>& 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<identifier>& id) {
void addFeature(const vt_geometry_collection& collection, const property_map& props, const optional<identifier>& 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
Expand All @@ -121,7 +121,7 @@ class InternalTile {
}

template <class T>
void addFeature(const T& multi, const property_map& props, const std::experimental::optional<identifier>& id) {
void addFeature(const T& multi, const property_map& props, const optional<identifier>& id) {
const auto new_multi = transform(multi);

switch (new_multi.size()) {
Expand Down
7 changes: 5 additions & 2 deletions include/mapbox/geojsonvt/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ struct vt_geometry_collection : std::vector<vt_geometry> {};
using property_map = mapbox::geometry::property_map;
using identifier = mapbox::geometry::identifier;

template <class T>
using optional = std::experimental::optional<T>;

template <class T>
struct vt_geometry_type;

Expand Down Expand Up @@ -128,12 +131,12 @@ struct vt_geometry_type<geometry::geometry_collection<double>> {
struct vt_feature {
vt_geometry geometry;
property_map properties;
std::experimental::optional<identifier> id;
optional<identifier> id;

mapbox::geometry::box<double> bbox = { { 2, 1 }, { -1, 0 } };
uint32_t num_points = 0;

vt_feature(const vt_geometry& geom, const property_map& props, const std::experimental::optional<identifier>& id_)
vt_feature(const vt_geometry& geom, const property_map& props, const optional<identifier>& id_)
: geometry(geom), properties(props), id(id_) {

mapbox::geometry::for_each_point(geom, [&](const vt_point& p) {
Expand Down

0 comments on commit 2c25bac

Please sign in to comment.