diff --git a/include/mbgl/actor/actor_ref.hpp b/include/mbgl/actor/actor_ref.hpp index c44ca0ea4..da2b20482 100644 --- a/include/mbgl/actor/actor_ref.hpp +++ b/include/mbgl/actor/actor_ref.hpp @@ -38,11 +38,7 @@ public: template auto ask(Fn fn, Args&&... args) const { // Result type is deduced from the function's return type -#if __cplusplus >= 201703L using ResultType = std::invoke_result_t; -#else - using ResultType = typename std::result_of::type; -#endif std::promise promise; auto future = promise.get_future(); diff --git a/include/mbgl/actor/established_actor.hpp b/include/mbgl/actor/established_actor.hpp index da0d8ac70..83d1bc311 100644 --- a/include/mbgl/actor/established_actor.hpp +++ b/include/mbgl/actor/established_actor.hpp @@ -28,10 +28,10 @@ template class EstablishedActor { public: // Construct the Object from a parameter pack `args` (i.e. `Object(args...)`) - template ::value || - std::is_constructible, Args...>::value - >::type * = nullptr> + template || + std::is_constructible_v, Args...> + > * = nullptr> EstablishedActor(Scheduler& scheduler, AspiringActor& parent_, Args&& ... args) : parent(parent_) { emplaceObject(std::forward(args)...); @@ -56,13 +56,13 @@ public: private: // Enabled for Objects with a constructor taking ActorRef as the first parameter - template , Args...>::value>::type * = nullptr> + template , Args...>> * = nullptr> void emplaceObject(Args&&... args_) { new (&parent.objectStorage) Object(parent.self(), std::forward(args_)...); } // Enabled for plain Objects - template ::value>::type * = nullptr> + template > * = nullptr> void emplaceObject(Args&&... args_) { new (&parent.objectStorage) Object(std::forward(args_)...); } diff --git a/include/mbgl/actor/message.hpp b/include/mbgl/actor/message.hpp index 0a2099335..52984b221 100644 --- a/include/mbgl/actor/message.hpp +++ b/include/mbgl/actor/message.hpp @@ -26,7 +26,7 @@ public: } void operator()() override { - invoke(std::make_index_sequence::value>()); + invoke(std::make_index_sequence>()); } template @@ -50,7 +50,7 @@ public: } void operator()() override { - promise.set_value(ask(std::make_index_sequence::value>())); + promise.set_value(ask(std::make_index_sequence>())); } template @@ -75,7 +75,7 @@ public: } void operator()() override { - ask(std::make_index_sequence::value>()); + ask(std::make_index_sequence>()); promise.set_value(); } diff --git a/include/mbgl/math/log2.hpp b/include/mbgl/math/log2.hpp index 4f5fde60d..4dfd5d5f9 100644 --- a/include/mbgl/math/log2.hpp +++ b/include/mbgl/math/log2.hpp @@ -34,7 +34,7 @@ T log2(T x) { defined(__ANDROID_API__) && __ANDROID_API__ < 18 template -typename std::enable_if_t::value, T> log2(T x) { +typename std::enable_if_t, T> log2(T x) { return ::log(x) / M_LN2; } diff --git a/include/mbgl/math/minmax.hpp b/include/mbgl/math/minmax.hpp index e8c50a39c..da6ba2096 100644 --- a/include/mbgl/math/minmax.hpp +++ b/include/mbgl/math/minmax.hpp @@ -8,32 +8,32 @@ namespace mbgl { namespace util { template -typename std::enable_if_t::value, T> max(T a, T b) { +typename std::enable_if_t, T> max(T a, T b) { return std::max(a, b); } template -typename std::enable_if_t::value, T> max(T a, T b) { +typename std::enable_if_t, T> max(T a, T b) { return ::fmax(a, b); } template -typename std::enable_if_t::value, T> max(T a, T b, Ts... args) { +typename std::enable_if_t, T> max(T a, T b, Ts... args) { return max(a, max(b, args...)); } template -typename std::enable_if_t::value, T> min(T a, T b) { +typename std::enable_if_t, T> min(T a, T b) { return std::min(a, b); } template -typename std::enable_if_t::value, T> min(T a, T b) { +typename std::enable_if_t, T> min(T a, T b) { return ::fmin(a, b); } template -typename std::enable_if_t::value, T> min(T a, T b, Ts... args) { +typename std::enable_if_t, T> min(T a, T b, Ts... args) { return min(a, min(b, args...)); } diff --git a/include/mbgl/style/conversion/constant.hpp b/include/mbgl/style/conversion/constant.hpp index 4acddfb01..bc3260e42 100644 --- a/include/mbgl/style/conversion/constant.hpp +++ b/include/mbgl/style/conversion/constant.hpp @@ -30,12 +30,12 @@ struct Converter { }; template -struct Converter::value>> { +struct Converter>> { optional operator()(const Convertible& value, Error& error) const; }; template -struct Converter, typename std::enable_if_t::value>> { +struct Converter, typename std::enable_if_t>> { optional> operator()(const Convertible& value, Error& error) const; }; diff --git a/include/mbgl/style/conversion_impl.hpp b/include/mbgl/style/conversion_impl.hpp index 468ed6d14..b8dfb4d08 100644 --- a/include/mbgl/style/conversion_impl.hpp +++ b/include/mbgl/style/conversion_impl.hpp @@ -317,17 +317,17 @@ struct ValueFactory { }; template -struct ValueFactory::value && !is_linear_container::value)>::type> { +struct ValueFactory && !is_linear_container::value)>> { static Value make(const T& arg) { return {arg}; } }; template -struct ValueFactory::value>::type> { +struct ValueFactory>> { static Value make(T arg) { return {Enum::toString(arg)}; } }; template -struct ValueFactory::value>::type> { +struct ValueFactory::value>> { static Value make(const T& arg) { mapbox::base::ValueArray result; result.reserve(arg.size()); diff --git a/include/mbgl/style/expression/value.hpp b/include/mbgl/style/expression/value.hpp index 8e91927f4..8b93e9f0f 100644 --- a/include/mbgl/style/expression/value.hpp +++ b/include/mbgl/style/expression/value.hpp @@ -128,7 +128,7 @@ struct ValueConverter { }; template -struct ValueConverter::value >> { +struct ValueConverter >> { static type::Type expressionType() { return type::String; } static Value toExpressionValue(const T& value); static optional fromExpressionValue(const Value& value); diff --git a/include/mbgl/util/convert.hpp b/include/mbgl/util/convert.hpp index 02ec7feef..aab8b8f04 100644 --- a/include/mbgl/util/convert.hpp +++ b/include/mbgl/util/convert.hpp @@ -8,7 +8,7 @@ namespace mbgl { namespace util { template::value>> + typename = std::enable_if_t>> MBGL_CONSTEXPR std::array convert(const std::array&from) { std::array to {{}}; std::copy(std::begin(from), std::end(from), std::begin(to)); diff --git a/include/mbgl/util/interpolate.hpp b/include/mbgl/util/interpolate.hpp index c8a9af3d2..f9d576317 100644 --- a/include/mbgl/util/interpolate.hpp +++ b/include/mbgl/util/interpolate.hpp @@ -176,7 +176,7 @@ struct Interpolator : Uninterpolated {}; template -struct Interpolator::value>> +struct Interpolator>> : Uninterpolated {}; template <> @@ -190,7 +190,7 @@ struct Interpolator> template struct Interpolatable : std::conditional_t< - !std::is_base_of>::value, + !std::is_base_of_v>, std::true_type, std::false_type> {}; diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp index 2a46c45ba..df205b907 100644 --- a/include/mbgl/util/string.hpp +++ b/include/mbgl/util/string.hpp @@ -48,22 +48,22 @@ inline std::string toString(uint8_t t) { return toString(static_cast(t)); } -template ::value>> +template >> inline std::string toString(unsigned long t) { return toString(static_cast(t)); } -template ::value>> +template >> inline std::string toString(unsigned long long t) { return toString(static_cast(t)); } -template ::value>> +template >> inline std::string toString(long t) { return toString(static_cast(t)); } -template ::value>> +template >> inline std::string toString(long long t) { return toString(static_cast(t)); } diff --git a/include/mbgl/util/traits.hpp b/include/mbgl/util/traits.hpp index e37144e60..75ae6f315 100644 --- a/include/mbgl/util/traits.hpp +++ b/include/mbgl/util/traits.hpp @@ -18,7 +18,7 @@ template <> struct is_utf16char_like: std::true_type {}; template <> struct is_utf16char_like: std::true_type {}; template <> struct is_utf16char_like: std::true_type {}; -template using is_utf16char_like_pointer = std::integral_constant::value +template using is_utf16char_like_pointer = std::integral_constant && is_utf16char_like::type>::value>; template diff --git a/include/mbgl/util/work_task_impl.hpp b/include/mbgl/util/work_task_impl.hpp index 276e0d623..8dcdd5ede 100644 --- a/include/mbgl/util/work_task_impl.hpp +++ b/include/mbgl/util/work_task_impl.hpp @@ -20,7 +20,7 @@ public: // Lock the mutex while processing so that cancel() will block. std::lock_guard lock(mutex); if (!*canceled) { - invoke(std::make_index_sequence::value>{}); + invoke(std::make_index_sequence>{}); } } diff --git a/platform/android/MapboxGLAndroidSDK/src/cpp/CMakeLists.txt b/platform/android/MapboxGLAndroidSDK/src/cpp/CMakeLists.txt index 7e0ffa111..8f931f4ed 100644 --- a/platform/android/MapboxGLAndroidSDK/src/cpp/CMakeLists.txt +++ b/platform/android/MapboxGLAndroidSDK/src/cpp/CMakeLists.txt @@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 3.10) add_subdirectory(../../../../../ ../../../../../${ANDROID_ABI}) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + target_compile_options(mbgl-compiler-options INTERFACE -frtti) add_library(mapbox-gl SHARED diff --git a/platform/ios/platform/darwin/darwin.xcconfig b/platform/ios/platform/darwin/darwin.xcconfig index 5c0914b33..97756226d 100644 --- a/platform/ios/platform/darwin/darwin.xcconfig +++ b/platform/ios/platform/darwin/darwin.xcconfig @@ -6,7 +6,7 @@ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES CLANG_ANALYZER_NONNULL = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES -CLANG_CXX_LANGUAGE_STANDARD = c++14 +CLANG_CXX_LANGUAGE_STANDARD = c++17 CLANG_CXX_LIBRARY = libc++ CLANG_ENABLE_OBJC_ARC = YES CLANG_WARN__DUPLICATE_METHOD_MATCH = YES diff --git a/src/mbgl/gfx/attribute.hpp b/src/mbgl/gfx/attribute.hpp index 62873d971..7b7f2ab6d 100644 --- a/src/mbgl/gfx/attribute.hpp +++ b/src/mbgl/gfx/attribute.hpp @@ -156,7 +156,7 @@ template struct Descriptor> { using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); - static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); + static_assert(std::is_standard_layout_v, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 1, { { A1::DataType, offsetof(Type, a1) }, }}; @@ -169,7 +169,7 @@ template struct Descriptor> { using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); - static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); + static_assert(std::is_standard_layout_v, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 2, { { A1::DataType, offsetof(Type, a1) }, { A2::DataType, offsetof(Type, a2) }, @@ -183,7 +183,7 @@ template struct Descriptor> { using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); - static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); + static_assert(std::is_standard_layout_v, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 3, { { A1::DataType, offsetof(Type, a1) }, { A2::DataType, offsetof(Type, a2) }, @@ -198,7 +198,7 @@ template struct Descriptor> { using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); - static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); + static_assert(std::is_standard_layout_v, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 4, { { A1::DataType, offsetof(Type, a1) }, { A2::DataType, offsetof(Type, a2) }, @@ -214,7 +214,7 @@ template struct Descriptor> { using Type = VertexType; static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes"); - static_assert(std::is_standard_layout::value, "vertex type must use standard layout"); + static_assert(std::is_standard_layout_v, "vertex type must use standard layout"); static constexpr const VertexDescriptor data = { sizeof(Type), 5, { { A1::DataType, offsetof(Type, a1) }, { A2::DataType, offsetof(Type, a2) }, diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp index d578bdb36..f7509ad08 100644 --- a/src/mbgl/gl/attribute.hpp +++ b/src/mbgl/gl/attribute.hpp @@ -34,14 +34,14 @@ public: void queryLocations(const ProgramID& id) { locations = Locations{ queryLocation(id, concat_literals<&string_literal<'a', '_'>::value, &As::name>::value())... }; - using TypeOfFirst = typename std::tuple_element<0, std::tuple>::type; + using TypeOfFirst = typename std::tuple_element_t<0, std::tuple>; auto first = locations.template get(); assert(first && first.value() == 0); } static constexpr const char* getFirstAttribName() { // Static assert that attribute list starts with position: we bind it on location 0. - using TypeOfFirst = typename std::tuple_element<0, std::tuple>::type; + using TypeOfFirst = typename std::tuple_element_t<0, std::tuple>; static_assert(std::is_same::value || std::is_same::value || std::is_same::value, "Program must start with position related attribute."); return concat_literals<&string_literal<'a', '_'>::value, TypeOfFirst::name>::value(); diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 99043624a..6bb4475aa 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -24,13 +24,13 @@ using namespace platform; static_assert(underlying_type(ShaderType::Vertex) == GL_VERTEX_SHADER, "OpenGL type mismatch"); static_assert(underlying_type(ShaderType::Fragment) == GL_FRAGMENT_SHADER, "OpenGL type mismatch"); -static_assert(std::is_same::value, "OpenGL type mismatch"); -static_assert(std::is_same::value, "OpenGL type mismatch"); -static_assert(std::is_same::value, "OpenGL type mismatch"); -static_assert(std::is_same::value, "OpenGL type mismatch"); -static_assert(std::is_same::value, "OpenGL type mismatch"); -static_assert(std::is_same::value, "OpenGL type mismatch"); -static_assert(std::is_same::value, "OpenGL type mismatch"); +static_assert(std::is_same_v, "OpenGL type mismatch"); +static_assert(std::is_same_v, "OpenGL type mismatch"); +static_assert(std::is_same_v, "OpenGL type mismatch"); +static_assert(std::is_same_v, "OpenGL type mismatch"); +static_assert(std::is_same_v, "OpenGL type mismatch"); +static_assert(std::is_same_v, "OpenGL type mismatch"); +static_assert(std::is_same_v, "OpenGL type mismatch"); static_assert(underlying_type(UniformDataType::Float) == GL_FLOAT, "OpenGL type mismatch"); static_assert(underlying_type(UniformDataType::FloatVec2) == GL_FLOAT_VEC2, "OpenGL type mismatch"); diff --git a/src/mbgl/gl/enum.hpp b/src/mbgl/gl/enum.hpp index 9780be55a..70243d646 100644 --- a/src/mbgl/gl/enum.hpp +++ b/src/mbgl/gl/enum.hpp @@ -10,8 +10,8 @@ namespace gl { template class Enum { public: - using InType = std::conditional_t, bool>::value, platform::GLboolean, platform::GLint>; - using OutType = std::conditional_t, bool>::value, platform::GLboolean, platform::GLenum>; + using InType = std::conditional_t, bool>, platform::GLboolean, platform::GLint>; + using OutType = std::conditional_t, bool>, platform::GLboolean, platform::GLenum>; static T from(InType); static OutType to(T); diff --git a/src/mbgl/style/conversion/constant.cpp b/src/mbgl/style/conversion/constant.cpp index 0e4e29f68..bd3f80470 100644 --- a/src/mbgl/style/conversion/constant.cpp +++ b/src/mbgl/style/conversion/constant.cpp @@ -33,7 +33,7 @@ optional Converter::operator()(const Convertible& valu } template -optional Converter::value>>::operator()(const Convertible& value, Error& error) const { +optional Converter>>::operator()(const Convertible& value, Error& error) const { optional string = toString(value); if (!string) { error.message = "value must be a string"; @@ -50,7 +50,7 @@ optional Converter::value>>::ope } template -auto Converter, typename std::enable_if_t::value>>::operator()(const Convertible& value, Error& error) const -> optional> { +auto Converter, typename std::enable_if_t>>::operator()(const Convertible& value, Error& error) const -> optional> { if (!isArray(value)) { error.message = "value must be an array"; return nullopt; diff --git a/src/mbgl/style/conversion/stringify.hpp b/src/mbgl/style/conversion/stringify.hpp index d7908153f..b3072b4db 100644 --- a/src/mbgl/style/conversion/stringify.hpp +++ b/src/mbgl/style/conversion/stringify.hpp @@ -48,7 +48,7 @@ void stringify(Writer& writer, const std::string& v) { writer.String(v); } -template ::value>> +template >> void stringify(Writer& writer, const T& v) { writer.String(Enum::toString(v)); } diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp index 3a41cad88..0a5c2ba3c 100644 --- a/src/mbgl/style/expression/compound_expression.cpp +++ b/src/mbgl/style/expression/compound_expression.cpp @@ -203,7 +203,7 @@ struct SignatureType { using Type = R (Params...); }; template -struct SignatureType::value>> +struct SignatureType>> { using Type = typename SignatureType::Type; }; template diff --git a/src/mbgl/style/expression/value.cpp b/src/mbgl/style/expression/value.cpp index 624e304ca..b79296d26 100644 --- a/src/mbgl/style/expression/value.cpp +++ b/src/mbgl/style/expression/value.cpp @@ -279,12 +279,12 @@ optional ValueConverter::fromExpressionValue(const Value& v) } template -Value ValueConverter::value >>::toExpressionValue(const T& value) { +Value ValueConverter>>::toExpressionValue(const T& value) { return std::string(Enum::toString(value)); } template -optional ValueConverter::value >>::fromExpressionValue(const Value& value) { +optional ValueConverter>>::fromExpressionValue(const Value& value) { return value.match( [&] (const std::string& v) { return Enum::toEnum(v); }, [&] (const auto&) { return optional(); } diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index c91cde74e..91f7e9060 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -65,7 +65,7 @@ public: const std::string& assetPath, float pixelRatio = 1, MapMode mode = MapMode::Static, - typename std::enable_if::value>::type* = nullptr) + typename std::enable_if_t>* = nullptr) : fileSource(std::make_shared(ResourceOptions().withCachePath(cachePath).withAssetPath(assetPath), ClientOptions())), frontend(pixelRatio), map(frontend,