diff options
-rw-r--r-- | include/mbgl/style/expression/compound_expression.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/style/expression/interpolate.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/style/expression/match.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/expression/step.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/tile/geometry_tile_data.hpp | 16 | ||||
-rw-r--r-- | test/api/recycle_map.cpp | 2 |
6 files changed, 28 insertions, 25 deletions
diff --git a/include/mbgl/style/expression/compound_expression.hpp b/include/mbgl/style/expression/compound_expression.hpp index 04562752a6..c618f2f206 100644 --- a/include/mbgl/style/expression/compound_expression.hpp +++ b/include/mbgl/style/expression/compound_expression.hpp @@ -33,7 +33,10 @@ namespace expression { */ struct VarargsType { type::Type type; }; template <typename T> -struct Varargs : std::vector<T> { using std::vector<T>::vector; }; +struct Varargs : std::vector<T> { + template <class... Args> + Varargs(Args&&... args) : std::vector<T>(std::forward<Args>(args)...) {} +}; namespace detail { // Base class for the Signature<Fn> structs that are used to determine diff --git a/src/mbgl/style/expression/interpolate.cpp b/src/mbgl/style/expression/interpolate.cpp index 852042382c..54fbc6e1d7 100644 --- a/src/mbgl/style/expression/interpolate.cpp +++ b/src/mbgl/style/expression/interpolate.cpp @@ -170,23 +170,23 @@ ParseResult parseInterpolate(const Convertible& value, ParsingContext& ctx) { labelValue->match( [&](uint64_t n) { if (n > std::numeric_limits<double>::max()) { - label = {std::numeric_limits<double>::infinity()}; + label = optional<double>{std::numeric_limits<double>::infinity()}; } else { - label = {static_cast<double>(n)}; + label = optional<double>{static_cast<double>(n)}; } }, [&](int64_t n) { if (n > std::numeric_limits<double>::max()) { - label = {std::numeric_limits<double>::infinity()}; + label = optional<double>{std::numeric_limits<double>::infinity()}; } else { - label = {static_cast<double>(n)}; + label = optional<double>{static_cast<double>(n)}; } }, [&](double n) { if (n > std::numeric_limits<double>::max()) { - label = {std::numeric_limits<double>::infinity()}; + label = optional<double>{std::numeric_limits<double>::infinity()}; } else { - label = {static_cast<double>(n)}; + label = optional<double>{n}; } }, [&](const auto&) {} diff --git a/src/mbgl/style/expression/match.cpp b/src/mbgl/style/expression/match.cpp index 340f1dab4d..4b4984811f 100644 --- a/src/mbgl/style/expression/match.cpp +++ b/src/mbgl/style/expression/match.cpp @@ -138,7 +138,7 @@ optional<InputType> parseInputValue(const Convertible& input, ParsingContext& pa parentContext.error("Branch labels must be integers no larger than " + util::toString(Value::maxSafeInteger()) + ".", index); } else { type = {type::Number}; - result = {static_cast<int64_t>(n)}; + result = optional<InputType>{static_cast<int64_t>(n)}; } }, [&] (int64_t n) { @@ -146,7 +146,7 @@ optional<InputType> parseInputValue(const Convertible& input, ParsingContext& pa parentContext.error("Branch labels must be integers no larger than " + util::toString(Value::maxSafeInteger()) + ".", index); } else { type = {type::Number}; - result = {n}; + result = optional<InputType>{n}; } }, [&] (double n) { @@ -156,7 +156,7 @@ optional<InputType> parseInputValue(const Convertible& input, ParsingContext& pa parentContext.error("Numeric branch labels must be integer values.", index); } else { type = {type::Number}; - result = {static_cast<int64_t>(n)}; + result = optional<InputType>{static_cast<int64_t>(n)}; } }, [&] (const std::string& s) { diff --git a/src/mbgl/style/expression/step.cpp b/src/mbgl/style/expression/step.cpp index ee6055091e..a1ca0a702e 100644 --- a/src/mbgl/style/expression/step.cpp +++ b/src/mbgl/style/expression/step.cpp @@ -127,23 +127,23 @@ ParseResult Step::parse(const mbgl::style::conversion::Convertible& value, Parsi labelValue->match( [&](uint64_t n) { if (n > std::numeric_limits<double>::max()) { - label = {std::numeric_limits<double>::infinity()}; + label = optional<double>{std::numeric_limits<double>::infinity()}; } else { - label = {static_cast<double>(n)}; + label = optional<double>{static_cast<double>(n)}; } }, [&](int64_t n) { if (n > std::numeric_limits<double>::max()) { - label = {std::numeric_limits<double>::infinity()}; + label = optional<double>{std::numeric_limits<double>::infinity()}; } else { - label = {static_cast<double>(n)}; + label = optional<double>{static_cast<double>(n)}; } }, [&](double n) { if (n > std::numeric_limits<double>::max()) { - label = {std::numeric_limits<double>::infinity()}; + label = optional<double>{std::numeric_limits<double>::infinity()}; } else { - label = {static_cast<double>(n)}; + label = optional<double>{n}; } }, [&](const auto&) {} diff --git a/src/mbgl/tile/geometry_tile_data.hpp b/src/mbgl/tile/geometry_tile_data.hpp index 449d8cab28..bd64a1d153 100644 --- a/src/mbgl/tile/geometry_tile_data.hpp +++ b/src/mbgl/tile/geometry_tile_data.hpp @@ -22,19 +22,19 @@ class GeometryCoordinates : public std::vector<GeometryCoordinate> { public: using coordinate_type = int16_t; - GeometryCoordinates() = default; - GeometryCoordinates(const std::vector<GeometryCoordinate>& v) - : std::vector<GeometryCoordinate>(v) {} - GeometryCoordinates(std::vector<GeometryCoordinate>&& v) - : std::vector<GeometryCoordinate>(std::move(v)) {} - - using std::vector<GeometryCoordinate>::vector; + template <class... Args> + GeometryCoordinates(Args&&... args) : std::vector<GeometryCoordinate>(std::forward<Args>(args)...) {} + GeometryCoordinates(std::initializer_list<GeometryCoordinate> args) + : std::vector<GeometryCoordinate>(std::move(args)) {} }; class GeometryCollection : public std::vector<GeometryCoordinates> { public: using coordinate_type = int16_t; - using std::vector<GeometryCoordinates>::vector; + template <class... Args> + GeometryCollection(Args&&... args) : std::vector<GeometryCoordinates>(std::forward<Args>(args)...) {} + GeometryCollection(std::initializer_list<GeometryCoordinates> args) + : std::vector<GeometryCoordinates>(std::move(args)) {} }; class GeometryTileFeature { diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp index ca6abac8c1..fc7e5223ec 100644 --- a/test/api/recycle_map.cpp +++ b/test/api/recycle_map.cpp @@ -35,7 +35,7 @@ TEST(API, RecycleMapUpdateImages) { auto loadStyle = [&](auto markerName, auto markerPath) { auto source = std::make_unique<GeoJSONSource>("geometry"); - source->setGeoJSON({ Point<double> { 0, 0 } }); + source->setGeoJSON( Geometry<double>{ Point<double>{ 0, 0 } } ); auto layer = std::make_unique<SymbolLayer>("geometry", "geometry"); layer->setIconImage({ markerName }); |