diff options
author | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2018-07-30 15:30:57 +0300 |
---|---|---|
committer | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2018-08-06 16:55:30 +0300 |
commit | 0130c58fdd74edbbfe668f3125a9377554d7d605 (patch) | |
tree | 6be1c1d25d146e9273f04f40f2283e18048c17ac /deps | |
parent | 7373abef92ed4911b91f9fca3d97784ed0d9e02e (diff) | |
download | qtlocation-mapboxgl-0130c58fdd74edbbfe668f3125a9377554d7d605.tar.gz |
Bump Mapbox GL Native
Bump version.
mapbox-gl-native @ 377a6e42d687c419e6ae1012b8626336f5dfc1b6
Diffstat (limited to 'deps')
-rw-r--r-- | deps/geojsonvt/6.5.1/include/mapbox/geojsonvt.hpp (renamed from deps/geojsonvt/6.3.0/include/mapbox/geojsonvt.hpp) | 35 | ||||
-rw-r--r-- | deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/clip.hpp (renamed from deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/clip.hpp) | 16 | ||||
-rw-r--r-- | deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/convert.hpp (renamed from deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/convert.hpp) | 3 | ||||
-rw-r--r-- | deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/simplify.hpp (renamed from deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/simplify.hpp) | 12 | ||||
-rw-r--r-- | deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/tile.hpp (renamed from deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/tile.hpp) | 59 | ||||
-rw-r--r-- | deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/types.hpp (renamed from deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/types.hpp) | 10 | ||||
-rw-r--r-- | deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/wrap.hpp (renamed from deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/wrap.hpp) | 0 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry.hpp) | 0 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/box.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/box.hpp) | 0 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/envelope.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/envelope.hpp) | 0 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/feature.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/feature.hpp) | 7 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/for_each_point.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/for_each_point.hpp) | 0 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/geometry.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/geometry.hpp) | 10 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/line_string.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/line_string.hpp) | 7 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/multi_line_string.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/multi_line_string.hpp) | 7 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/multi_point.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/multi_point.hpp) | 7 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/multi_polygon.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/multi_polygon.hpp) | 7 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/point.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/point.hpp) | 0 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/point_arithmetic.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/point_arithmetic.hpp) | 0 | ||||
-rw-r--r-- | deps/geometry/0.9.3/include/mapbox/geometry/polygon.hpp (renamed from deps/geometry/0.9.2/include/mapbox/geometry/polygon.hpp) | 14 | ||||
-rw-r--r-- | deps/optional/f27e7908/include/experimental/optional | 1052 | ||||
-rw-r--r-- | deps/vector-tile/1.0.2/include/mapbox/vector_tile.hpp (renamed from deps/vector-tile/1.0.1/include/mapbox/vector_tile.hpp) | 8 | ||||
-rw-r--r-- | deps/vector-tile/1.0.2/include/mapbox/vector_tile/vector_tile_config.hpp (renamed from deps/vector-tile/1.0.1/include/mapbox/vector_tile/vector_tile_config.hpp) | 0 | ||||
-rw-r--r-- | deps/vector-tile/1.0.2/include/mapbox/vector_tile/version.hpp (renamed from deps/vector-tile/1.0.1/include/mapbox/vector_tile/version.hpp) | 4 |
24 files changed, 1162 insertions, 96 deletions
diff --git a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt.hpp b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt.hpp index ee1bbbca8d..af5bbc3129 100644 --- a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt.hpp +++ b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt.hpp @@ -51,9 +51,6 @@ struct Options : TileOptions { // max number of points per tile in the tile index uint32_t indexMaxPoints = 100000; - - // whether to tile solid square tiles further - bool solidChildren = false; }; const Tile empty_tile{}; @@ -63,12 +60,12 @@ inline uint64_t toID(uint8_t z, uint32_t x, uint32_t y) { } inline const Tile geoJSONToTile(const geojson& geojson_, - uint8_t z, - uint32_t x, - uint32_t y, - const TileOptions& options = TileOptions(), - bool wrap = false, - bool clip = false) { + uint8_t z, + uint32_t x, + uint32_t y, + const TileOptions& options = TileOptions(), + bool wrap = false, + bool clip = false) { const auto features_ = geojson::visit(geojson_, ToFeatureCollection{}); auto z2 = 1u << z; @@ -83,8 +80,7 @@ inline const Tile geoJSONToTile(const geojson& geojson_, const auto left = detail::clip<0>(features, (x - p) / z2, (x + 1 + p) / z2, -1, 2); features = detail::clip<1>(left, (y - p) / z2, (y + 1 + p) / z2, -1, 2); } - return detail::InternalTile({ features, z, x, y, options.extent, options.buffer, tolerance }) - .tile; + return detail::InternalTile({ features, z, x, y, options.extent, tolerance }).tile; } class GeoJSONVT { @@ -131,10 +127,6 @@ public: // if we found a parent tile containing the original geometry, we can drill down from it const auto& parent = it->second; - // parent tile is a solid clipped square, return it instead since it's identical - if (parent.is_solid) - return parent.tile; - // drill down parent tile up to the requested one splitTile(parent.source_features, parent.z, parent.x, parent.y, z, x, y); @@ -146,11 +138,6 @@ public: if (it == tiles.end()) throw std::runtime_error("Parent tile not found"); - // drilling stopped because parent was a solid square; return it instead - if (it->second.is_solid) - return it->second.tile; - - // otherwise it was an empty tile return empty_tile; } @@ -198,8 +185,8 @@ private: (z == options.maxZoom ? 0 : options.tolerance / (z2 * options.extent)); it = tiles - .emplace(id, detail::InternalTile{ features, z, x, y, options.extent, - options.buffer, tolerance }) + .emplace(id, + detail::InternalTile{ features, z, x, y, options.extent, tolerance }) .first; stats[z] = (stats.count(z) ? stats[z] + 1 : 1); total++; @@ -211,10 +198,6 @@ private: if (features.empty()) return; - // stop tiling if the tile is solid clipped square - if (!options.solidChildren && tile.is_solid) - return; - // if it's the first-pass tiling if (cz == 0u) { // stop tiling if we reached max zoom, or if the tile is too simple diff --git a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/clip.hpp b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/clip.hpp index 212e2979d0..e6f305921f 100644 --- a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/clip.hpp +++ b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/clip.hpp @@ -116,13 +116,13 @@ private: if (i == len - 2) slice.push_back(b); // last point } - } else if (ak > k2) { + } else if (ak >= k2) { if (bk < k1) { // <--|-----|--- slice.push_back(intersect<I>(a, b, k2)); slice.push_back(intersect<I>(a, b, k1)); slice = newSlice(slices, slice, dist); - } else if (bk <= k2) { // | <--|--- + } else if (bk < k2) { // | <--|--- slice.push_back(intersect<I>(a, b, k2)); if (i == len - 2) slice.push_back(b); // last point @@ -171,8 +171,8 @@ private: else if (i == len - 2) slice.push_back(b); // last point } - } else if (ak > k2) { - if (bk <= k2) { // | <--|--- + } else if (ak >= k2) { + if (bk < k2) { // | <--|--- slice.push_back(intersect<I>(a, b, k2)); if (bk < k1) // <--|-----|--- slice.push_back(intersect<I>(a, b, k1)); @@ -216,10 +216,10 @@ inline vt_features clip(const vt_features& features, const double minAll, const double maxAll) { - if (minAll >= k1 && maxAll <= k2) // trivial accept + if (minAll >= k1 && maxAll < k2) // trivial accept return features; - if (minAll > k2 || maxAll < k1) // trivial reject + if (maxAll < k1 || minAll >= k2) // trivial reject return {}; vt_features clipped; @@ -232,10 +232,10 @@ inline vt_features clip(const vt_features& features, const double min = get<I>(feature.bbox.min); const double max = get<I>(feature.bbox.max); - if (min >= k1 && max <= k2) { // trivial accept + if (min >= k1 && max < k2) { // trivial accept clipped.push_back(feature); - } else if (min > k2 || max < k1) { // trivial reject + } else if (max < k1 || min >= k2) { // trivial reject continue; } else { diff --git a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/convert.hpp b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/convert.hpp index ba28f449b3..88c036f02c 100644 --- a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/convert.hpp +++ b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/convert.hpp @@ -99,8 +99,7 @@ inline vt_features convert(const geometry::feature_collection<double>& features, for (const auto& feature : features) { projected.emplace_back( geometry::geometry<double>::visit(feature.geometry, project{ tolerance }), - feature.properties, - feature.id); + feature.properties, feature.id); } return projected; } diff --git a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/simplify.hpp b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/simplify.hpp index be0165b0f1..784f085e7f 100644 --- a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/simplify.hpp +++ b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/simplify.hpp @@ -37,6 +37,8 @@ inline double getSqSegDist(const vt_point& p, const vt_point& a, const vt_point& inline void simplify(std::vector<vt_point>& points, size_t first, size_t last, double sqTolerance) { double maxSqDist = sqTolerance; size_t index = 0; + const int64_t mid = (last - first) >> 1; + int64_t minPosToMid = last - first; for (auto i = first + 1; i < last; i++) { const double sqDist = getSqSegDist(points[i], points[first], points[last]); @@ -44,6 +46,16 @@ inline void simplify(std::vector<vt_point>& points, size_t first, size_t last, d if (sqDist > maxSqDist) { index = i; maxSqDist = sqDist; + + } else if (sqDist == maxSqDist) { + // a workaround to ensure we choose a pivot close to the middle of the list, + // reducing recursion depth, for certain degenerate inputs + // https://github.com/mapbox/geojson-vt/issues/104 + auto posToMid = std::abs(static_cast<int64_t>(i) - mid); + if (posToMid < minPosToMid) { + index = i; + minPosToMid = posToMid; + } } } diff --git a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/tile.hpp b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/tile.hpp index ccb230bb9c..e382346779 100644 --- a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/tile.hpp +++ b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/tile.hpp @@ -17,12 +17,16 @@ namespace detail { class InternalTile { public: + const uint16_t extent; const uint8_t z; const uint32_t x; const uint32_t y; + const double z2; + const double tolerance; + const double sq_tolerance; + vt_features source_features; - bool is_solid = false; mapbox::geometry::box<double> bbox = { { 2, 1 }, { -1, 0 } }; Tile tile; @@ -32,13 +36,12 @@ public: const uint32_t x_, const uint32_t y_, const uint16_t extent_, - const uint16_t buffer, const double tolerance_) - : z(z_), + : extent(extent_), + z(z_), x(x_), y(y_), z2(std::pow(2, z)), - extent(extent_), tolerance(tolerance_), sq_tolerance(tolerance_ * tolerance_) { @@ -59,59 +62,33 @@ public: bbox.max.x = std::max(feature.bbox.max.x, bbox.max.x); bbox.max.y = std::max(feature.bbox.max.y, bbox.max.y); } - - is_solid = isSolid(buffer); } private: - const double z2; - const uint16_t extent; - const double tolerance; - const double sq_tolerance; - - bool isSolid(const uint16_t buffer) { - if (tile.features.size() != 1) - return false; - - const auto& geom = tile.features.front().geometry; - if (!geom.is<mapbox::geometry::polygon<int16_t>>()) - return false; - - const auto& rings = geom.get<mapbox::geometry::polygon<int16_t>>(); - if (rings.size() > 1) - return false; - - const auto& ring = rings.front(); - if (ring.size() != 5) - return false; - - const int16_t min = -static_cast<int16_t>(buffer); - const int16_t max = static_cast<int16_t>(extent + buffer); - for (const auto& p : ring) { - if ((p.x != min && p.x != max) || (p.y != min && p.y != max)) - return false; - } - - return true; - } - - void addFeature(const vt_point& point, const property_map& props, const 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 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 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 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 diff --git a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/types.hpp b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/types.hpp index b54357a7b9..b65844f432 100644 --- a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/types.hpp +++ b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/types.hpp @@ -60,13 +60,19 @@ using vt_multi_point = std::vector<vt_point>; struct vt_line_string : std::vector<vt_point> { using container_type = std::vector<vt_point>; - using container_type::container_type; + vt_line_string() = default; + vt_line_string(std::initializer_list<vt_point> args) + : container_type(std::move(args)) {} + double dist = 0.0; // line length }; struct vt_linear_ring : std::vector<vt_point> { using container_type = std::vector<vt_point>; - using container_type::container_type; + vt_linear_ring() = default; + vt_linear_ring(std::initializer_list<vt_point> args) + : container_type(std::move(args)) {} + double area = 0.0; // polygon ring area }; diff --git a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/wrap.hpp b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/wrap.hpp index 495ccc5800..495ccc5800 100644 --- a/deps/geojsonvt/6.3.0/include/mapbox/geojsonvt/wrap.hpp +++ b/deps/geojsonvt/6.5.1/include/mapbox/geojsonvt/wrap.hpp diff --git a/deps/geometry/0.9.2/include/mapbox/geometry.hpp b/deps/geometry/0.9.3/include/mapbox/geometry.hpp index e232453179..e232453179 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry.hpp diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/box.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/box.hpp index bf81b703ec..bf81b703ec 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/box.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/box.hpp diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/envelope.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/envelope.hpp index 8603583985..8603583985 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/envelope.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/envelope.hpp diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/feature.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/feature.hpp index 20d2ddf6b8..685c01229f 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/feature.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/feature.hpp @@ -84,7 +84,12 @@ struct feature_collection : Cont<feature<T>> using coordinate_type = T; using feature_type = feature<T>; using container_type = Cont<feature_type>; - using container_type::container_type; + using size_type = typename container_type::size_type; + + template <class... Args> + feature_collection(Args&&... args) : container_type(std::forward<Args>(args)...) {} + feature_collection(std::initializer_list<feature_type> args) + : container_type(std::move(args)) {} }; } // namespace geometry diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/for_each_point.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/for_each_point.hpp index 44d6e77bd0..44d6e77bd0 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/for_each_point.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/for_each_point.hpp diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/geometry.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/geometry.hpp index a9d072be7e..3b86117220 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/geometry.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/geometry.hpp @@ -46,12 +46,12 @@ struct geometry_collection : Cont<geometry<T>> using coordinate_type = T; using geometry_type = geometry<T>; using container_type = Cont<geometry_type>; + using size_type = typename container_type::size_type; - geometry_collection() = default; - geometry_collection(geometry_collection const&) = default; - geometry_collection(geometry_collection &&) = default; - geometry_collection(std::initializer_list<geometry_type> && args) - : container_type(std::forward<std::initializer_list<geometry_type>>(args)) {}; + template <class... Args> + geometry_collection(Args&&... args) : container_type(std::forward<Args>(args)...) {} + geometry_collection(std::initializer_list<geometry_type> args) + : container_type(std::move(args)) {} }; } // namespace geometry diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/line_string.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/line_string.hpp index 6d811ce221..d11d06bd84 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/line_string.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/line_string.hpp @@ -14,7 +14,12 @@ struct line_string : Cont<point<T> > using coordinate_type = T; using point_type = point<T>; using container_type = Cont<point_type>; - using container_type::container_type; + using size_type = typename container_type::size_type; + + template <class... Args> + line_string(Args&&... args) : container_type(std::forward<Args>(args)...) {} + line_string(std::initializer_list<point_type> args) + : container_type(std::move(args)) {} }; } // namespace geometry diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/multi_line_string.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/multi_line_string.hpp index 07a7a1d609..7dfefd8ffa 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/multi_line_string.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/multi_line_string.hpp @@ -14,7 +14,12 @@ struct multi_line_string : Cont<line_string<T>> using coordinate_type = T; using line_string_type = line_string<T>; using container_type = Cont<line_string_type>; - using container_type::container_type; + using size_type = typename container_type::size_type; + + template <class... Args> + multi_line_string(Args&&... args) : container_type(std::forward<Args>(args)...) {} + multi_line_string(std::initializer_list<line_string_type> args) + : container_type(std::move(args)) {} }; } // namespace geometry diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/multi_point.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/multi_point.hpp index a3c73cff91..d2d7a6768a 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/multi_point.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/multi_point.hpp @@ -14,7 +14,12 @@ struct multi_point : Cont<point<T>> using coordinate_type = T; using point_type = point<T>; using container_type = Cont<point_type>; - using container_type::container_type; + using size_type = typename container_type::size_type; + + template <class... Args> + multi_point(Args&&... args) : container_type(std::forward<Args>(args)...) {} + multi_point(std::initializer_list<point_type> args) + : container_type(std::move(args)) {} }; } // namespace geometry diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/multi_polygon.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/multi_polygon.hpp index ad230a04c8..0e3cb321a4 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/multi_polygon.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/multi_polygon.hpp @@ -14,7 +14,12 @@ struct multi_polygon : Cont<polygon<T>> using coordinate_type = T; using polygon_type = polygon<T>; using container_type = Cont<polygon_type>; - using container_type::container_type; + using size_type = typename container_type::size_type; + + template <class... Args> + multi_polygon(Args&&... args) : container_type(std::forward<Args>(args)...) {} + multi_polygon(std::initializer_list<polygon_type> args) + : container_type(std::move(args)) {} }; } // namespace geometry diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/point.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/point.hpp index 0cba4996e7..0cba4996e7 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/point.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/point.hpp diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/point_arithmetic.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/point_arithmetic.hpp index 0c4c63278a..0c4c63278a 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/point_arithmetic.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/point_arithmetic.hpp diff --git a/deps/geometry/0.9.2/include/mapbox/geometry/polygon.hpp b/deps/geometry/0.9.3/include/mapbox/geometry/polygon.hpp index 99a66aa125..0c7e1161cb 100644 --- a/deps/geometry/0.9.2/include/mapbox/geometry/polygon.hpp +++ b/deps/geometry/0.9.3/include/mapbox/geometry/polygon.hpp @@ -15,7 +15,12 @@ struct linear_ring : Cont<point<T>> using coordinate_type = T; using point_type = point<T>; using container_type = Cont<point_type>; - using container_type::container_type; + using size_type = typename container_type::size_type; + + template <class... Args> + linear_ring(Args&&... args) : container_type(std::forward<Args>(args)...) {} + linear_ring(std::initializer_list<point_type> args) + : container_type(std::move(args)) {} }; template <typename T, template <typename...> class Cont = std::vector> @@ -24,7 +29,12 @@ struct polygon : Cont<linear_ring<T>> using coordinate_type = T; using linear_ring_type = linear_ring<T>; using container_type = Cont<linear_ring_type>; - using container_type::container_type; + using size_type = typename container_type::size_type; + + template <class... Args> + polygon(Args&&... args) : container_type(std::forward<Args>(args)...) {} + polygon(std::initializer_list<linear_ring_type> args) + : container_type(std::move(args)) {} }; } // namespace geometry diff --git a/deps/optional/f27e7908/include/experimental/optional b/deps/optional/f27e7908/include/experimental/optional new file mode 100644 index 0000000000..7b9148f3a7 --- /dev/null +++ b/deps/optional/f27e7908/include/experimental/optional @@ -0,0 +1,1052 @@ +// Copyright (C) 2011 - 2012 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// The idea and interface is based on Boost.Optional library +// authored by Fernando Luis Cacciola Carballal + +# ifndef ___OPTIONAL_HPP___ +# define ___OPTIONAL_HPP___ + +# include <utility> +# include <type_traits> +# include <initializer_list> +# include <cassert> +# include <functional> +# include <string> +# include <stdexcept> + +# define TR2_OPTIONAL_REQUIRES(...) typename enable_if<__VA_ARGS__::value, bool>::type = false + +# if defined __GNUC__ // NOTE: GNUC is also defined for Clang +# if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8) +# define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ +# elif (__GNUC__ > 4) +# define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ +# endif +# +# if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7) +# define TR2_OPTIONAL_GCC_4_7_AND_HIGHER___ +# elif (__GNUC__ > 4) +# define TR2_OPTIONAL_GCC_4_7_AND_HIGHER___ +# endif +# +# if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ >= 1) +# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9) +# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# elif (__GNUC__ > 4) +# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# endif +# endif +# +# if defined __clang_major__ +# if (__clang_major__ == 3 && __clang_minor__ >= 5) +# define TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ +# elif (__clang_major__ > 3) +# define TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ +# endif +# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ +# define TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_ +# elif (__clang_major__ == 3 && __clang_minor__ == 4 && __clang_patchlevel__ >= 2) +# define TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_ +# endif +# endif +# +# if defined _MSC_VER +# if (_MSC_VER >= 1900) +# define TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ +# endif +# endif + +# if defined __clang__ +# if (__clang_major__ > 2) || (__clang_major__ == 2) && (__clang_minor__ >= 9) +# define OPTIONAL_HAS_THIS_RVALUE_REFS 1 +# else +# define OPTIONAL_HAS_THIS_RVALUE_REFS 0 +# endif +# elif defined TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# define OPTIONAL_HAS_THIS_RVALUE_REFS 1 +# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ +# define OPTIONAL_HAS_THIS_RVALUE_REFS 1 +# else +# define OPTIONAL_HAS_THIS_RVALUE_REFS 0 +# endif + + +# if defined TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___ +# define OPTIONAL_HAS_CONSTEXPR_INIT_LIST 1 +# define OPTIONAL_CONSTEXPR_INIT_LIST constexpr +# else +# define OPTIONAL_HAS_CONSTEXPR_INIT_LIST 0 +# define OPTIONAL_CONSTEXPR_INIT_LIST +# endif + +# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L) +# define OPTIONAL_HAS_MOVE_ACCESSORS 1 +# else +# define OPTIONAL_HAS_MOVE_ACCESSORS 0 +# endif + +# // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr +# if (defined __cplusplus) && (__cplusplus == 201103L) +# define OPTIONAL_MUTABLE_CONSTEXPR +# else +# define OPTIONAL_MUTABLE_CONSTEXPR constexpr +# endif + +namespace std{ + +namespace experimental{ + +// BEGIN workaround for missing is_trivially_destructible +# if defined TR2_OPTIONAL_GCC_4_8_AND_HIGHER___ + // leave it: it is already there +# elif defined TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_ + // leave it: it is already there +# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ + // leave it: it is already there +# elif defined TR2_OPTIONAL_DISABLE_EMULATION_OF_TYPE_TRAITS + // leave it: the user doesn't want it +# else + template <typename T> + using is_trivially_destructible = std::has_trivial_destructor<T>; +# endif +// END workaround for missing is_trivially_destructible + +# if (defined TR2_OPTIONAL_GCC_4_7_AND_HIGHER___) + // leave it; our metafunctions are already defined. +# elif defined TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_ + // leave it; our metafunctions are already defined. +# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___ + // leave it: it is already there +# elif defined TR2_OPTIONAL_DISABLE_EMULATION_OF_TYPE_TRAITS + // leave it: the user doesn't want it +# else + + +// workaround for missing traits in GCC and CLANG +template <class T> +struct is_nothrow_move_constructible +{ + constexpr static bool value = std::is_nothrow_constructible<T, T&&>::value; +}; + + +template <class T, class U> +struct is_assignable +{ + template <class X, class Y> + constexpr static bool has_assign(...) { return false; } + + template <class X, class Y, size_t S = sizeof((std::declval<X>() = std::declval<Y>(), true)) > + // the comma operator is necessary for the cases where operator= returns void + constexpr static bool has_assign(bool) { return true; } + + constexpr static bool value = has_assign<T, U>(true); +}; + + +template <class T> +struct is_nothrow_move_assignable +{ + template <class X, bool has_any_move_assign> + struct has_nothrow_move_assign { + constexpr static bool value = false; + }; + + template <class X> + struct has_nothrow_move_assign<X, true> { + constexpr static bool value = noexcept( std::declval<X&>() = std::declval<X&&>() ); + }; + + constexpr static bool value = has_nothrow_move_assign<T, is_assignable<T&, T&&>::value>::value; +}; +// end workaround + + +# endif + + + +// 20.5.4, optional for object types +template <class T> class optional; + +// 20.5.5, optional for lvalue reference types +template <class T> class optional<T&>; + + +// workaround: std utility functions aren't constexpr yet +template <class T> inline constexpr T&& constexpr_forward(typename std::remove_reference<T>::type& t) noexcept +{ + return static_cast<T&&>(t); +} + +template <class T> inline constexpr T&& constexpr_forward(typename std::remove_reference<T>::type&& t) noexcept +{ + static_assert(!std::is_lvalue_reference<T>::value, "!!"); + return static_cast<T&&>(t); +} + +template <class T> inline constexpr typename std::remove_reference<T>::type&& constexpr_move(T&& t) noexcept +{ + return static_cast<typename std::remove_reference<T>::type&&>(t); +} + + +#if defined NDEBUG +# define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) (EXPR) +#else +# define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) ((CHECK) ? (EXPR) : ([]{assert(!#CHECK);}(), (EXPR))) +#endif + + +namespace detail_ +{ + +// static_addressof: a constexpr version of addressof +template <typename T> +struct has_overloaded_addressof +{ + template <class X> + constexpr static bool has_overload(...) { return false; } + + template <class X, size_t S = sizeof(std::declval<X&>().operator&()) > + constexpr static bool has_overload(bool) { return true; } + + constexpr static bool value = has_overload<T>(true); +}; + +template <typename T, TR2_OPTIONAL_REQUIRES(!has_overloaded_addressof<T>)> +constexpr T* static_addressof(T& ref) +{ + return &ref; +} + +template <typename T, TR2_OPTIONAL_REQUIRES(has_overloaded_addressof<T>)> +T* static_addressof(T& ref) +{ + return std::addressof(ref); +} + + +// the call to convert<A>(b) has return type A and converts b to type A iff b decltype(b) is implicitly convertible to A +template <class U> +constexpr U convert(U v) { return v; } + +} // namespace detail + + +constexpr struct trivial_init_t{} trivial_init{}; + + +// 20.5.6, In-place construction +constexpr struct in_place_t{} in_place{}; + + +// 20.5.7, Disengaged state indicator +struct nullopt_t +{ + struct init{}; + constexpr explicit nullopt_t(init){} +}; +constexpr nullopt_t nullopt{nullopt_t::init()}; + + +// 20.5.8, class bad_optional_access +class bad_optional_access : public logic_error { +public: + explicit bad_optional_access(const string& what_arg) : logic_error{what_arg} {} + explicit bad_optional_access(const char* what_arg) : logic_error{what_arg} {} +}; + + +template <class T> +union storage_t +{ + unsigned char dummy_; + T value_; + + constexpr storage_t( trivial_init_t ) noexcept : dummy_() {}; + + template <class... Args> + constexpr storage_t( Args&&... args ) : value_(constexpr_forward<Args>(args)...) {} + + ~storage_t(){} +}; + + +template <class T> +union constexpr_storage_t +{ + unsigned char dummy_; + T value_; + + constexpr constexpr_storage_t( trivial_init_t ) noexcept : dummy_() {}; + + template <class... Args> + constexpr constexpr_storage_t( Args&&... args ) : value_(constexpr_forward<Args>(args)...) {} + + ~constexpr_storage_t() = default; +}; + + +template <class T> +struct optional_base +{ + bool init_; + storage_t<T> storage_; + + constexpr optional_base() noexcept : init_(false), storage_(trivial_init) {}; + + explicit constexpr optional_base(const T& v) : init_(true), storage_(v) {} + + explicit constexpr optional_base(T&& v) : init_(true), storage_(constexpr_move(v)) {} + + template <class... Args> explicit optional_base(in_place_t, Args&&... args) + : init_(true), storage_(constexpr_forward<Args>(args)...) {} + + template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<U>>)> + explicit optional_base(in_place_t, std::initializer_list<U> il, Args&&... args) + : init_(true), storage_(il, std::forward<Args>(args)...) {} + + ~optional_base() { if (init_) storage_.value_.T::~T(); } +}; + + +template <class T> +struct constexpr_optional_base +{ + bool init_; + constexpr_storage_t<T> storage_; + + constexpr constexpr_optional_base() noexcept : init_(false), storage_(trivial_init) {}; + + explicit constexpr constexpr_optional_base(const T& v) : init_(true), storage_(v) {} + + explicit constexpr constexpr_optional_base(T&& v) : init_(true), storage_(constexpr_move(v)) {} + + template <class... Args> explicit constexpr constexpr_optional_base(in_place_t, Args&&... args) + : init_(true), storage_(constexpr_forward<Args>(args)...) {} + + template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<U>>)> + OPTIONAL_CONSTEXPR_INIT_LIST explicit constexpr_optional_base(in_place_t, std::initializer_list<U> il, Args&&... args) + : init_(true), storage_(il, std::forward<Args>(args)...) {} + + ~constexpr_optional_base() = default; +}; + +template <class T> +using OptionalBase = typename std::conditional< + is_trivially_destructible<T>::value, // if possible + constexpr_optional_base<typename std::remove_const<T>::type>, // use base with trivial destructor + optional_base<typename std::remove_const<T>::type> +>::type; + + + +template <class T> +class optional : private OptionalBase<T> +{ + static_assert( !std::is_same<typename std::decay<T>::type, nullopt_t>::value, "bad T" ); + static_assert( !std::is_same<typename std::decay<T>::type, in_place_t>::value, "bad T" ); + + + constexpr bool initialized() const noexcept { return OptionalBase<T>::init_; } + typename std::remove_const<T>::type* dataptr() { return std::addressof(OptionalBase<T>::storage_.value_); } + constexpr const T* dataptr() const { return detail_::static_addressof(OptionalBase<T>::storage_.value_); } + +# if OPTIONAL_HAS_THIS_RVALUE_REFS == 1 + constexpr const T& contained_val() const& { return OptionalBase<T>::storage_.value_; } +# if OPTIONAL_HAS_MOVE_ACCESSORS == 1 + OPTIONAL_MUTABLE_CONSTEXPR T&& contained_val() && { return std::move(OptionalBase<T>::storage_.value_); } + OPTIONAL_MUTABLE_CONSTEXPR T& contained_val() & { return OptionalBase<T>::storage_.value_; } +# else + T& contained_val() & { return OptionalBase<T>::storage_.value_; } + T&& contained_val() && { return std::move(OptionalBase<T>::storage_.value_); } +# endif +# else + constexpr const T& contained_val() const { return OptionalBase<T>::storage_.value_; } + T& contained_val() { return OptionalBase<T>::storage_.value_; } +# endif + + void clear() noexcept { + if (initialized()) dataptr()->T::~T(); + OptionalBase<T>::init_ = false; + } + + template <class... Args> + void initialize(Args&&... args) noexcept(noexcept(T(std::forward<Args>(args)...))) + { + assert(!OptionalBase<T>::init_); + ::new (static_cast<void*>(dataptr())) T(std::forward<Args>(args)...); + OptionalBase<T>::init_ = true; + } + + template <class U, class... Args> + void initialize(std::initializer_list<U> il, Args&&... args) noexcept(noexcept(T(il, std::forward<Args>(args)...))) + { + assert(!OptionalBase<T>::init_); + ::new (static_cast<void*>(dataptr())) T(il, std::forward<Args>(args)...); + OptionalBase<T>::init_ = true; + } + +public: + typedef T value_type; + + // 20.5.5.1, constructors + constexpr optional() noexcept : OptionalBase<T>() {}; + constexpr optional(nullopt_t) noexcept : OptionalBase<T>() {}; + + optional(const optional& rhs) + : OptionalBase<T>() + { + if (rhs.initialized()) { + ::new (static_cast<void*>(dataptr())) T(*rhs); + OptionalBase<T>::init_ = true; + } + } + + optional(optional&& rhs) noexcept(is_nothrow_move_constructible<T>::value) + : OptionalBase<T>() + { + if (rhs.initialized()) { + ::new (static_cast<void*>(dataptr())) T(std::move(*rhs)); + OptionalBase<T>::init_ = true; + } + } + + constexpr optional(const T& v) : OptionalBase<T>(v) {} + + constexpr optional(T&& v) : OptionalBase<T>(constexpr_move(v)) {} + + template <class... Args> + explicit constexpr optional(in_place_t, Args&&... args) + : OptionalBase<T>(in_place_t{}, constexpr_forward<Args>(args)...) {} + + template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<U>>)> + OPTIONAL_CONSTEXPR_INIT_LIST explicit optional(in_place_t, std::initializer_list<U> il, Args&&... args) + : OptionalBase<T>(in_place_t{}, il, constexpr_forward<Args>(args)...) {} + + // 20.5.4.2, Destructor + ~optional() = default; + + // 20.5.4.3, assignment + optional& operator=(nullopt_t) noexcept + { + clear(); + return *this; + } + + optional& operator=(const optional& rhs) + { + if (initialized() == true && rhs.initialized() == false) clear(); + else if (initialized() == false && rhs.initialized() == true) initialize(*rhs); + else if (initialized() == true && rhs.initialized() == true) contained_val() = *rhs; + return *this; + } + + optional& operator=(optional&& rhs) + noexcept(is_nothrow_move_assignable<T>::value && is_nothrow_move_constructible<T>::value) + { + if (initialized() == true && rhs.initialized() == false) clear(); + else if (initialized() == false && rhs.initialized() == true) initialize(std::move(*rhs)); + else if (initialized() == true && rhs.initialized() == true) contained_val() = std::move(*rhs); + return *this; + } + + template <class U> + auto operator=(U&& v) + -> typename enable_if + < + is_same<typename decay<U>::type, T>::value, + optional& + >::type + { + if (initialized()) { contained_val() = std::forward<U>(v); } + else { initialize(std::forward<U>(v)); } + return *this; + } + + + template <class... Args> + void emplace(Args&&... args) + { + clear(); + initialize(std::forward<Args>(args)...); + } + + template <class U, class... Args> + void emplace(initializer_list<U> il, Args&&... args) + { + clear(); + initialize<U, Args...>(il, std::forward<Args>(args)...); + } + + // 20.5.4.4, Swap + void swap(optional<T>& rhs) noexcept(is_nothrow_move_constructible<T>::value && noexcept(swap(declval<T&>(), declval<T&>()))) + { + if (initialized() == true && rhs.initialized() == false) { rhs.initialize(std::move(**this)); clear(); } + else if (initialized() == false && rhs.initialized() == true) { initialize(std::move(*rhs)); rhs.clear(); } + else if (initialized() == true && rhs.initialized() == true) { using std::swap; swap(**this, *rhs); } + } + + // 20.5.4.5, Observers + + explicit constexpr operator bool() const noexcept { return initialized(); } + constexpr bool has_value() const noexcept { return initialized(); } + + constexpr T const* operator ->() const { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), dataptr()); + } + +# if OPTIONAL_HAS_MOVE_ACCESSORS == 1 + + OPTIONAL_MUTABLE_CONSTEXPR T* operator ->() { + assert (initialized()); + return dataptr(); + } + + constexpr T const& operator *() const& { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val()); + } + + OPTIONAL_MUTABLE_CONSTEXPR T& operator *() & { + assert (initialized()); + return contained_val(); + } + + OPTIONAL_MUTABLE_CONSTEXPR T&& operator *() && { + assert (initialized()); + return constexpr_move(contained_val()); + } + + constexpr T const& value() const& { + return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val()); + } + + OPTIONAL_MUTABLE_CONSTEXPR T& value() & { + return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val()); + } + + OPTIONAL_MUTABLE_CONSTEXPR T&& value() && { + if (!initialized()) throw bad_optional_access("bad optional access"); + return std::move(contained_val()); + } + +# else + + T* operator ->() { + assert (initialized()); + return dataptr(); + } + + constexpr T const& operator *() const { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val()); + } + + T& operator *() { + assert (initialized()); + return contained_val(); + } + + constexpr T const& value() const { + return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val()); + } + + T& value() { + return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val()); + } + +# endif + +# if OPTIONAL_HAS_THIS_RVALUE_REFS == 1 + + template <class V> + constexpr T value_or(V&& v) const& + { + return *this ? **this : detail_::convert<T>(constexpr_forward<V>(v)); + } + +# if OPTIONAL_HAS_MOVE_ACCESSORS == 1 + + template <class V> + OPTIONAL_MUTABLE_CONSTEXPR T value_or(V&& v) && + { + return *this ? constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert<T>(constexpr_forward<V>(v)); + } + +# else + + template <class V> + T value_or(V&& v) && + { + return *this ? constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert<T>(constexpr_forward<V>(v)); + } + +# endif + +# else + + template <class V> + constexpr T value_or(V&& v) const + { + return *this ? **this : detail_::convert<T>(constexpr_forward<V>(v)); + } + +# endif + + // 20.6.3.6, modifiers + void reset() noexcept { clear(); } +}; + + +template <class T> +class optional<T&> +{ + static_assert( !std::is_same<T, nullopt_t>::value, "bad T" ); + static_assert( !std::is_same<T, in_place_t>::value, "bad T" ); + T* ref; + +public: + + // 20.5.5.1, construction/destruction + constexpr optional() noexcept : ref(nullptr) {} + + constexpr optional(nullopt_t) noexcept : ref(nullptr) {} + + constexpr optional(T& v) noexcept : ref(detail_::static_addressof(v)) {} + + optional(T&&) = delete; + + constexpr optional(const optional& rhs) noexcept : ref(rhs.ref) {} + + explicit constexpr optional(in_place_t, T& v) noexcept : ref(detail_::static_addressof(v)) {} + + explicit optional(in_place_t, T&&) = delete; + + ~optional() = default; + + // 20.5.5.2, mutation + optional& operator=(nullopt_t) noexcept { + ref = nullptr; + return *this; + } + + // optional& operator=(const optional& rhs) noexcept { + // ref = rhs.ref; + // return *this; + // } + + // optional& operator=(optional&& rhs) noexcept { + // ref = rhs.ref; + // return *this; + // } + + template <typename U> + auto operator=(U&& rhs) noexcept + -> typename enable_if + < + is_same<typename decay<U>::type, optional<T&>>::value, + optional& + >::type + { + ref = rhs.ref; + return *this; + } + + template <typename U> + auto operator=(U&& rhs) noexcept + -> typename enable_if + < + !is_same<typename decay<U>::type, optional<T&>>::value, + optional& + >::type + = delete; + + void emplace(T& v) noexcept { + ref = detail_::static_addressof(v); + } + + void emplace(T&&) = delete; + + + void swap(optional<T&>& rhs) noexcept + { + std::swap(ref, rhs.ref); + } + + // 20.5.5.3, observers + constexpr T* operator->() const { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, ref); + } + + constexpr T& operator*() const { + return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, *ref); + } + + constexpr T& value() const { + return ref ? *ref : (throw bad_optional_access("bad optional access"), *ref); + } + + explicit constexpr operator bool() const noexcept { + return ref != nullptr; + } + + constexpr bool has_value() const noexcept { + return ref != nullptr; + } + + template <class V> + constexpr typename decay<T>::type value_or(V&& v) const + { + return *this ? **this : detail_::convert<typename decay<T>::type>(constexpr_forward<V>(v)); + } + + // x.x.x.x, modifiers + void reset() noexcept { ref = nullptr; } +}; + + +template <class T> +class optional<T&&> +{ + static_assert( sizeof(T) == 0, "optional rvalue references disallowed" ); +}; + + +// 20.5.8, Relational operators +template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y) +{ + return bool(x) != bool(y) ? false : bool(x) == false ? true : *x == *y; +} + +template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y) +{ + return !(x == y); +} + +template <class T> constexpr bool operator<(const optional<T>& x, const optional<T>& y) +{ + return (!y) ? false : (!x) ? true : *x < *y; +} + +template <class T> constexpr bool operator>(const optional<T>& x, const optional<T>& y) +{ + return (y < x); +} + +template <class T> constexpr bool operator<=(const optional<T>& x, const optional<T>& y) +{ + return !(y < x); +} + +template <class T> constexpr bool operator>=(const optional<T>& x, const optional<T>& y) +{ + return !(x < y); +} + + +// 20.5.9, Comparison with nullopt +template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept +{ + return (!x); +} + +template <class T> constexpr bool operator==(nullopt_t, const optional<T>& x) noexcept +{ + return (!x); +} + +template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept +{ + return bool(x); +} + +template <class T> constexpr bool operator!=(nullopt_t, const optional<T>& x) noexcept +{ + return bool(x); +} + +template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept +{ + return false; +} + +template <class T> constexpr bool operator<(nullopt_t, const optional<T>& x) noexcept +{ + return bool(x); +} + +template <class T> constexpr bool operator<=(const optional<T>& x, nullopt_t) noexcept +{ + return (!x); +} + +template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept +{ + return true; +} + +template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept +{ + return bool(x); +} + +template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept +{ + return false; +} + +template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept +{ + return true; +} + +template <class T> constexpr bool operator>=(nullopt_t, const optional<T>& x) noexcept +{ + return (!x); +} + + + +// 20.5.10, Comparison with T +template <class T> constexpr bool operator==(const optional<T>& x, const T& v) +{ + return bool(x) ? *x == v : false; +} + +template <class T> constexpr bool operator==(const T& v, const optional<T>& x) +{ + return bool(x) ? v == *x : false; +} + +template <class T> constexpr bool operator!=(const optional<T>& x, const T& v) +{ + return bool(x) ? *x != v : true; +} + +template <class T> constexpr bool operator!=(const T& v, const optional<T>& x) +{ + return bool(x) ? v != *x : true; +} + +template <class T> constexpr bool operator<(const optional<T>& x, const T& v) +{ + return bool(x) ? *x < v : true; +} + +template <class T> constexpr bool operator>(const T& v, const optional<T>& x) +{ + return bool(x) ? v > *x : true; +} + +template <class T> constexpr bool operator>(const optional<T>& x, const T& v) +{ + return bool(x) ? *x > v : false; +} + +template <class T> constexpr bool operator<(const T& v, const optional<T>& x) +{ + return bool(x) ? v < *x : false; +} + +template <class T> constexpr bool operator>=(const optional<T>& x, const T& v) +{ + return bool(x) ? *x >= v : false; +} + +template <class T> constexpr bool operator<=(const T& v, const optional<T>& x) +{ + return bool(x) ? v <= *x : false; +} + +template <class T> constexpr bool operator<=(const optional<T>& x, const T& v) +{ + return bool(x) ? *x <= v : true; +} + +template <class T> constexpr bool operator>=(const T& v, const optional<T>& x) +{ + return bool(x) ? v >= *x : true; +} + + +// Comparison of optional<T&> with T +template <class T> constexpr bool operator==(const optional<T&>& x, const T& v) +{ + return bool(x) ? *x == v : false; +} + +template <class T> constexpr bool operator==(const T& v, const optional<T&>& x) +{ + return bool(x) ? v == *x : false; +} + +template <class T> constexpr bool operator!=(const optional<T&>& x, const T& v) +{ + return bool(x) ? *x != v : true; +} + +template <class T> constexpr bool operator!=(const T& v, const optional<T&>& x) +{ + return bool(x) ? v != *x : true; +} + +template <class T> constexpr bool operator<(const optional<T&>& x, const T& v) +{ + return bool(x) ? *x < v : true; +} + +template <class T> constexpr bool operator>(const T& v, const optional<T&>& x) +{ + return bool(x) ? v > *x : true; +} + +template <class T> constexpr bool operator>(const optional<T&>& x, const T& v) +{ + return bool(x) ? *x > v : false; +} + +template <class T> constexpr bool operator<(const T& v, const optional<T&>& x) +{ + return bool(x) ? v < *x : false; +} + +template <class T> constexpr bool operator>=(const optional<T&>& x, const T& v) +{ + return bool(x) ? *x >= v : false; +} + +template <class T> constexpr bool operator<=(const T& v, const optional<T&>& x) +{ + return bool(x) ? v <= *x : false; +} + +template <class T> constexpr bool operator<=(const optional<T&>& x, const T& v) +{ + return bool(x) ? *x <= v : true; +} + +template <class T> constexpr bool operator>=(const T& v, const optional<T&>& x) +{ + return bool(x) ? v >= *x : true; +} + +// Comparison of optional<T const&> with T +template <class T> constexpr bool operator==(const optional<const T&>& x, const T& v) +{ + return bool(x) ? *x == v : false; +} + +template <class T> constexpr bool operator==(const T& v, const optional<const T&>& x) +{ + return bool(x) ? v == *x : false; +} + +template <class T> constexpr bool operator!=(const optional<const T&>& x, const T& v) +{ + return bool(x) ? *x != v : true; +} + +template <class T> constexpr bool operator!=(const T& v, const optional<const T&>& x) +{ + return bool(x) ? v != *x : true; +} + +template <class T> constexpr bool operator<(const optional<const T&>& x, const T& v) +{ + return bool(x) ? *x < v : true; +} + +template <class T> constexpr bool operator>(const T& v, const optional<const T&>& x) +{ + return bool(x) ? v > *x : true; +} + +template <class T> constexpr bool operator>(const optional<const T&>& x, const T& v) +{ + return bool(x) ? *x > v : false; +} + +template <class T> constexpr bool operator<(const T& v, const optional<const T&>& x) +{ + return bool(x) ? v < *x : false; +} + +template <class T> constexpr bool operator>=(const optional<const T&>& x, const T& v) +{ + return bool(x) ? *x >= v : false; +} + +template <class T> constexpr bool operator<=(const T& v, const optional<const T&>& x) +{ + return bool(x) ? v <= *x : false; +} + +template <class T> constexpr bool operator<=(const optional<const T&>& x, const T& v) +{ + return bool(x) ? *x <= v : true; +} + +template <class T> constexpr bool operator>=(const T& v, const optional<const T&>& x) +{ + return bool(x) ? v >= *x : true; +} + + +// 20.5.12, Specialized algorithms +template <class T> +void swap(optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y))) +{ + x.swap(y); +} + + +template <class T> +constexpr optional<typename decay<T>::type> make_optional(T&& v) +{ + return optional<typename decay<T>::type>(constexpr_forward<T>(v)); +} + +template <class X> +constexpr optional<X&> make_optional(reference_wrapper<X> v) +{ + return optional<X&>(v.get()); +} + + +} // namespace experimental +} // namespace std + +namespace std +{ + template <typename T> + struct hash<std::experimental::optional<T>> + { + typedef typename hash<T>::result_type result_type; + typedef std::experimental::optional<T> argument_type; + + constexpr result_type operator()(argument_type const& arg) const { + return arg ? std::hash<T>{}(*arg) : result_type{}; + } + }; + + template <typename T> + struct hash<std::experimental::optional<T&>> + { + typedef typename hash<T>::result_type result_type; + typedef std::experimental::optional<T&> argument_type; + + constexpr result_type operator()(argument_type const& arg) const { + return arg ? std::hash<T>{}(*arg) : result_type{}; + } + }; +} + +# undef TR2_OPTIONAL_REQUIRES +# undef TR2_OPTIONAL_ASSERTED_EXPRESSION + +# endif //___OPTIONAL_HPP___ diff --git a/deps/vector-tile/1.0.1/include/mapbox/vector_tile.hpp b/deps/vector-tile/1.0.2/include/mapbox/vector_tile.hpp index 2308462c68..5ddae485f0 100644 --- a/deps/vector-tile/1.0.1/include/mapbox/vector_tile.hpp +++ b/deps/vector-tile/1.0.2/include/mapbox/vector_tile.hpp @@ -23,13 +23,15 @@ using point_type = mapbox::geometry::point<std::int16_t>; class points_array_type : public std::vector<point_type> { public: using coordinate_type = point_type::coordinate_type; - using std::vector<point_type>::vector; + template <class... Args> + points_array_type(Args&&... args) : std::vector<point_type>(std::forward<Args>(args)...) {} }; class points_arrays_type : public std::vector<points_array_type> { public: using coordinate_type = points_array_type::coordinate_type; - using std::vector<points_array_type>::vector; + template <class... Args> + points_arrays_type(Args&&... args) : std::vector<points_array_type>(std::forward<Args>(args)...) {} }; class layer; @@ -137,7 +139,7 @@ inline feature::feature(protozero::data_view const& feature_view, layer const& l while (feature_pbf.next()) { switch (feature_pbf.tag()) { case FeatureType::ID: - id = { feature_pbf.get_uint64() }; + id = optional<mapbox::geometry::identifier>{ feature_pbf.get_uint64() }; break; case FeatureType::TAGS: tags_iter = feature_pbf.get_packed_uint32(); diff --git a/deps/vector-tile/1.0.1/include/mapbox/vector_tile/vector_tile_config.hpp b/deps/vector-tile/1.0.2/include/mapbox/vector_tile/vector_tile_config.hpp index acf1185673..acf1185673 100644 --- a/deps/vector-tile/1.0.1/include/mapbox/vector_tile/vector_tile_config.hpp +++ b/deps/vector-tile/1.0.2/include/mapbox/vector_tile/vector_tile_config.hpp diff --git a/deps/vector-tile/1.0.1/include/mapbox/vector_tile/version.hpp b/deps/vector-tile/1.0.2/include/mapbox/vector_tile/version.hpp index 13b8755d3c..cc1974d63c 100644 --- a/deps/vector-tile/1.0.1/include/mapbox/vector_tile/version.hpp +++ b/deps/vector-tile/1.0.2/include/mapbox/vector_tile/version.hpp @@ -7,10 +7,10 @@ #define VECTOR_TILE_VERSION_MINOR 0 /// The patch number -#define VECTOR_TILE_VERSION_PATCH 1 +#define VECTOR_TILE_VERSION_PATCH 2 /// The complete version number #define VECTOR_TILE_VERSION_CODE (VECTOR_TILE_VERSION_MAJOR * 10000 + VECTOR_TILE_VERSION_MINOR * 100 + VECTOR_TILE_VERSION_PATCH) /// Version number as string -#define VECTOR_TILE_VERSION_STRING "1.0.1" +#define VECTOR_TILE_VERSION_STRING "1.0.2" |