Use *_t and *_v trait helpers from C++17 STL (#731)
This commit is contained in:
@@ -38,11 +38,7 @@ public:
|
||||
template <typename Fn, class... Args>
|
||||
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<decltype(fn), Object, Args...>;
|
||||
#else
|
||||
using ResultType = typename std::result_of<decltype(fn)(Object, Args...)>::type;
|
||||
#endif
|
||||
|
||||
std::promise<ResultType> promise;
|
||||
auto future = promise.get_future();
|
||||
|
||||
@@ -28,10 +28,10 @@ template <class Object>
|
||||
class EstablishedActor {
|
||||
public:
|
||||
// Construct the Object from a parameter pack `args` (i.e. `Object(args...)`)
|
||||
template <typename U = Object, class... Args, typename std::enable_if<
|
||||
std::is_constructible<U, Args...>::value ||
|
||||
std::is_constructible<U, ActorRef<U>, Args...>::value
|
||||
>::type * = nullptr>
|
||||
template <typename U = Object, class... Args, typename std::enable_if_t<
|
||||
std::is_constructible_v<U, Args...> ||
|
||||
std::is_constructible_v<U, ActorRef<U>, Args...>
|
||||
> * = nullptr>
|
||||
EstablishedActor(Scheduler& scheduler, AspiringActor<Object>& parent_, Args&& ... args)
|
||||
: parent(parent_) {
|
||||
emplaceObject(std::forward<Args>(args)...);
|
||||
@@ -56,13 +56,13 @@ public:
|
||||
|
||||
private:
|
||||
// Enabled for Objects with a constructor taking ActorRef<Object> as the first parameter
|
||||
template <typename U = Object, class... Args, typename std::enable_if<std::is_constructible<U, ActorRef<U>, Args...>::value>::type * = nullptr>
|
||||
template <typename U = Object, class... Args, typename std::enable_if_t<std::is_constructible_v<U, ActorRef<U>, Args...>> * = nullptr>
|
||||
void emplaceObject(Args&&... args_) {
|
||||
new (&parent.objectStorage) Object(parent.self(), std::forward<Args>(args_)...);
|
||||
}
|
||||
|
||||
// Enabled for plain Objects
|
||||
template <typename U = Object, class... Args, typename std::enable_if<std::is_constructible<U, Args...>::value>::type * = nullptr>
|
||||
template <typename U = Object, class... Args, typename std::enable_if_t<std::is_constructible_v<U, Args...>> * = nullptr>
|
||||
void emplaceObject(Args&&... args_) {
|
||||
new (&parent.objectStorage) Object(std::forward<Args>(args_)...);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
}
|
||||
|
||||
void operator()() override {
|
||||
invoke(std::make_index_sequence<std::tuple_size<ArgsTuple>::value>());
|
||||
invoke(std::make_index_sequence<std::tuple_size_v<ArgsTuple>>());
|
||||
}
|
||||
|
||||
template <std::size_t... I>
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
}
|
||||
|
||||
void operator()() override {
|
||||
promise.set_value(ask(std::make_index_sequence<std::tuple_size<ArgsTuple>::value>()));
|
||||
promise.set_value(ask(std::make_index_sequence<std::tuple_size_v<ArgsTuple>>()));
|
||||
}
|
||||
|
||||
template <std::size_t... I>
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
void operator()() override {
|
||||
ask(std::make_index_sequence<std::tuple_size<ArgsTuple>::value>());
|
||||
ask(std::make_index_sequence<std::tuple_size_v<ArgsTuple>>());
|
||||
promise.set_value();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ T log2(T x) {
|
||||
defined(__ANDROID_API__) && __ANDROID_API__ < 18
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if_t<std::is_floating_point<T>::value, T> log2(T x) {
|
||||
typename std::enable_if_t<std::is_floating_point_v<T>, T> log2(T x) {
|
||||
return ::log(x) / M_LN2;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,32 +8,32 @@ namespace mbgl {
|
||||
namespace util {
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if_t<std::is_integral<T>::value, T> max(T a, T b) {
|
||||
typename std::enable_if_t<std::is_integral_v<T>, T> max(T a, T b) {
|
||||
return std::max(a, b);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if_t<std::is_floating_point<T>::value, T> max(T a, T b) {
|
||||
typename std::enable_if_t<std::is_floating_point_v<T>, T> max(T a, T b) {
|
||||
return ::fmax(a, b);
|
||||
}
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
typename std::enable_if_t<std::is_arithmetic<T>::value, T> max(T a, T b, Ts... args) {
|
||||
typename std::enable_if_t<std::is_arithmetic_v<T>, T> max(T a, T b, Ts... args) {
|
||||
return max(a, max(b, args...));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if_t<std::is_integral<T>::value, T> min(T a, T b) {
|
||||
typename std::enable_if_t<std::is_integral_v<T>, T> min(T a, T b) {
|
||||
return std::min(a, b);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if_t<std::is_floating_point<T>::value, T> min(T a, T b) {
|
||||
typename std::enable_if_t<std::is_floating_point_v<T>, T> min(T a, T b) {
|
||||
return ::fmin(a, b);
|
||||
}
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
typename std::enable_if_t<std::is_arithmetic<T>::value, T> min(T a, T b, Ts... args) {
|
||||
typename std::enable_if_t<std::is_arithmetic_v<T>, T> min(T a, T b, Ts... args) {
|
||||
return min(a, min(b, args...));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,12 +30,12 @@ struct Converter<std::string> {
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct Converter<T, typename std::enable_if_t<std::is_enum<T>::value>> {
|
||||
struct Converter<T, typename std::enable_if_t<std::is_enum_v<T>>> {
|
||||
optional<T> operator()(const Convertible& value, Error& error) const;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct Converter<std::vector<T>, typename std::enable_if_t<std::is_enum<T>::value>> {
|
||||
struct Converter<std::vector<T>, typename std::enable_if_t<std::is_enum_v<T>>> {
|
||||
optional<std::vector<T>> operator()(const Convertible& value, Error& error) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -317,17 +317,17 @@ struct ValueFactory<Color> {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ValueFactory<T, typename std::enable_if<(!std::is_enum<T>::value && !is_linear_container<T>::value)>::type> {
|
||||
struct ValueFactory<T, typename std::enable_if_t<(!std::is_enum_v<T> && !is_linear_container<T>::value)>> {
|
||||
static Value make(const T& arg) { return {arg}; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ValueFactory<T, typename std::enable_if<std::is_enum<T>::value>::type> {
|
||||
struct ValueFactory<T, typename std::enable_if_t<std::is_enum_v<T>>> {
|
||||
static Value make(T arg) { return {Enum<T>::toString(arg)}; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ValueFactory<T, typename std::enable_if<is_linear_container<T>::value>::type> {
|
||||
struct ValueFactory<T, typename std::enable_if_t<is_linear_container<T>::value>> {
|
||||
static Value make(const T& arg) {
|
||||
mapbox::base::ValueArray result;
|
||||
result.reserve(arg.size());
|
||||
|
||||
@@ -128,7 +128,7 @@ struct ValueConverter<Position> {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ValueConverter<T, std::enable_if_t< std::is_enum<T>::value >> {
|
||||
struct ValueConverter<T, std::enable_if_t< std::is_enum_v<T> >> {
|
||||
static type::Type expressionType() { return type::String; }
|
||||
static Value toExpressionValue(const T& value);
|
||||
static optional<T> fromExpressionValue(const Value& value);
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace mbgl {
|
||||
namespace util {
|
||||
|
||||
template<typename To, typename From, std::size_t Size,
|
||||
typename = std::enable_if_t<std::is_convertible<From, To>::value>>
|
||||
typename = std::enable_if_t<std::is_convertible_v<From, To>>>
|
||||
MBGL_CONSTEXPR std::array<To, Size> convert(const std::array<From, Size>&from) {
|
||||
std::array<To, Size> to {{}};
|
||||
std::copy(std::begin(from), std::end(from), std::begin(to));
|
||||
|
||||
@@ -176,7 +176,7 @@ struct Interpolator<bool>
|
||||
: Uninterpolated {};
|
||||
|
||||
template <class T>
|
||||
struct Interpolator<T, typename std::enable_if_t<std::is_enum<T>::value>>
|
||||
struct Interpolator<T, typename std::enable_if_t<std::is_enum_v<T>>>
|
||||
: Uninterpolated {};
|
||||
|
||||
template <>
|
||||
@@ -190,7 +190,7 @@ struct Interpolator<std::vector<T>>
|
||||
template <class T>
|
||||
struct Interpolatable
|
||||
: std::conditional_t<
|
||||
!std::is_base_of<Uninterpolated, Interpolator<T>>::value,
|
||||
!std::is_base_of_v<Uninterpolated, Interpolator<T>>,
|
||||
std::true_type,
|
||||
std::false_type> {};
|
||||
|
||||
|
||||
@@ -48,22 +48,22 @@ inline std::string toString(uint8_t t) {
|
||||
return toString(static_cast<uint32_t>(t));
|
||||
}
|
||||
|
||||
template <typename = std::enable_if<!std::is_same<uint64_t, unsigned long>::value>>
|
||||
template <typename = std::enable_if<!std::is_same_v<uint64_t, unsigned long>>>
|
||||
inline std::string toString(unsigned long t) {
|
||||
return toString(static_cast<uint64_t>(t));
|
||||
}
|
||||
|
||||
template <typename = std::enable_if<!std::is_same<uint64_t, unsigned long long>::value>>
|
||||
template <typename = std::enable_if<!std::is_same_v<uint64_t, unsigned long long>>>
|
||||
inline std::string toString(unsigned long long t) {
|
||||
return toString(static_cast<uint64_t>(t));
|
||||
}
|
||||
|
||||
template <typename = std::enable_if<!std::is_same<int64_t, long>::value>>
|
||||
template <typename = std::enable_if<!std::is_same_v<int64_t, long>>>
|
||||
inline std::string toString(long t) {
|
||||
return toString(static_cast<int64_t>(t));
|
||||
}
|
||||
|
||||
template <typename = std::enable_if<!std::is_same<int64_t, long long>::value>>
|
||||
template <typename = std::enable_if<!std::is_same_v<int64_t, long long>>>
|
||||
inline std::string toString(long long t) {
|
||||
return toString(static_cast<int64_t>(t));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ template <> struct is_utf16char_like<char16_t>: std::true_type {};
|
||||
template <> struct is_utf16char_like<wchar_t>: std::true_type {};
|
||||
template <> struct is_utf16char_like<uint16_t>: std::true_type {};
|
||||
|
||||
template <typename T> using is_utf16char_like_pointer = std::integral_constant<bool, std::is_pointer<T>::value
|
||||
template <typename T> using is_utf16char_like_pointer = std::integral_constant<bool, std::is_pointer_v<T>
|
||||
&& is_utf16char_like<typename std::remove_pointer<T>::type>::value>;
|
||||
|
||||
template <class OutPointer, class InChar>
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
// Lock the mutex while processing so that cancel() will block.
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
if (!*canceled) {
|
||||
invoke(std::make_index_sequence<std::tuple_size<P>::value>{});
|
||||
invoke(std::make_index_sequence<std::tuple_size_v<P>>{});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -156,7 +156,7 @@ template <class A1>
|
||||
struct Descriptor<VertexType<A1>> {
|
||||
using Type = VertexType<A1>;
|
||||
static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes");
|
||||
static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout");
|
||||
static_assert(std::is_standard_layout_v<Type>, "vertex type must use standard layout");
|
||||
static constexpr const VertexDescriptor data = { sizeof(Type), 1, {
|
||||
{ A1::DataType, offsetof(Type, a1) },
|
||||
}};
|
||||
@@ -169,7 +169,7 @@ template <class A1, class A2>
|
||||
struct Descriptor<VertexType<A1, A2>> {
|
||||
using Type = VertexType<A1, A2>;
|
||||
static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes");
|
||||
static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout");
|
||||
static_assert(std::is_standard_layout_v<Type>, "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 <class A1, class A2, class A3>
|
||||
struct Descriptor<VertexType<A1, A2, A3>> {
|
||||
using Type = VertexType<A1, A2, A3>;
|
||||
static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes");
|
||||
static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout");
|
||||
static_assert(std::is_standard_layout_v<Type>, "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 <class A1, class A2, class A3, class A4>
|
||||
struct Descriptor<VertexType<A1, A2, A3, A4>> {
|
||||
using Type = VertexType<A1, A2, A3, A4>;
|
||||
static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes");
|
||||
static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout");
|
||||
static_assert(std::is_standard_layout_v<Type>, "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 <class A1, class A2, class A3, class A4, class A5>
|
||||
struct Descriptor<VertexType<A1, A2, A3, A4, A5>> {
|
||||
using Type = VertexType<A1, A2, A3, A4, A5>;
|
||||
static_assert(sizeof(Type) < 256, "vertex type must be smaller than 256 bytes");
|
||||
static_assert(std::is_standard_layout<Type>::value, "vertex type must use standard layout");
|
||||
static_assert(std::is_standard_layout_v<Type>, "vertex type must use standard layout");
|
||||
static constexpr const VertexDescriptor data = { sizeof(Type), 5, {
|
||||
{ A1::DataType, offsetof(Type, a1) },
|
||||
{ A2::DataType, offsetof(Type, a2) },
|
||||
|
||||
@@ -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<As...>>::type;
|
||||
using TypeOfFirst = typename std::tuple_element_t<0, std::tuple<As...>>;
|
||||
auto first = locations.template get<TypeOfFirst>();
|
||||
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<As...>>::type;
|
||||
using TypeOfFirst = typename std::tuple_element_t<0, std::tuple<As...>>;
|
||||
static_assert(std::is_same<attributes::pos, TypeOfFirst>::value || std::is_same<attributes::pos_offset, TypeOfFirst>::value ||
|
||||
std::is_same<attributes::pos_normal, TypeOfFirst>::value, "Program must start with position related attribute.");
|
||||
return concat_literals<&string_literal<'a', '_'>::value, TypeOfFirst::name>::value();
|
||||
|
||||
@@ -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<ProgramID, GLuint>::value, "OpenGL type mismatch");
|
||||
static_assert(std::is_same<ShaderID, GLuint>::value, "OpenGL type mismatch");
|
||||
static_assert(std::is_same<BufferID, GLuint>::value, "OpenGL type mismatch");
|
||||
static_assert(std::is_same<TextureID, GLuint>::value, "OpenGL type mismatch");
|
||||
static_assert(std::is_same<VertexArrayID, GLuint>::value, "OpenGL type mismatch");
|
||||
static_assert(std::is_same<FramebufferID, GLuint>::value, "OpenGL type mismatch");
|
||||
static_assert(std::is_same<RenderbufferID, GLuint>::value, "OpenGL type mismatch");
|
||||
static_assert(std::is_same_v<ProgramID, GLuint>, "OpenGL type mismatch");
|
||||
static_assert(std::is_same_v<ShaderID, GLuint>, "OpenGL type mismatch");
|
||||
static_assert(std::is_same_v<BufferID, GLuint>, "OpenGL type mismatch");
|
||||
static_assert(std::is_same_v<TextureID, GLuint>, "OpenGL type mismatch");
|
||||
static_assert(std::is_same_v<VertexArrayID, GLuint>, "OpenGL type mismatch");
|
||||
static_assert(std::is_same_v<FramebufferID, GLuint>, "OpenGL type mismatch");
|
||||
static_assert(std::is_same_v<RenderbufferID, GLuint>, "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");
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace gl {
|
||||
template <typename T>
|
||||
class Enum {
|
||||
public:
|
||||
using InType = std::conditional_t<std::is_same<std::underlying_type_t<T>, bool>::value, platform::GLboolean, platform::GLint>;
|
||||
using OutType = std::conditional_t<std::is_same<std::underlying_type_t<T>, bool>::value, platform::GLboolean, platform::GLenum>;
|
||||
using InType = std::conditional_t<std::is_same_v<std::underlying_type_t<T>, bool>, platform::GLboolean, platform::GLint>;
|
||||
using OutType = std::conditional_t<std::is_same_v<std::underlying_type_t<T>, bool>, platform::GLboolean, platform::GLenum>;
|
||||
|
||||
static T from(InType);
|
||||
static OutType to(T);
|
||||
|
||||
@@ -33,7 +33,7 @@ optional<std::string> Converter<std::string>::operator()(const Convertible& valu
|
||||
}
|
||||
|
||||
template <class T>
|
||||
optional<T> Converter<T, typename std::enable_if_t<std::is_enum<T>::value>>::operator()(const Convertible& value, Error& error) const {
|
||||
optional<T> Converter<T, typename std::enable_if_t<std::is_enum_v<T>>>::operator()(const Convertible& value, Error& error) const {
|
||||
optional<std::string> string = toString(value);
|
||||
if (!string) {
|
||||
error.message = "value must be a string";
|
||||
@@ -50,7 +50,7 @@ optional<T> Converter<T, typename std::enable_if_t<std::is_enum<T>::value>>::ope
|
||||
}
|
||||
|
||||
template <class T>
|
||||
auto Converter<std::vector<T>, typename std::enable_if_t<std::is_enum<T>::value>>::operator()(const Convertible& value, Error& error) const -> optional<std::vector<T>> {
|
||||
auto Converter<std::vector<T>, typename std::enable_if_t<std::is_enum_v<T>>>::operator()(const Convertible& value, Error& error) const -> optional<std::vector<T>> {
|
||||
if (!isArray(value)) {
|
||||
error.message = "value must be an array";
|
||||
return nullopt;
|
||||
|
||||
@@ -48,7 +48,7 @@ void stringify(Writer& writer, const std::string& v) {
|
||||
writer.String(v);
|
||||
}
|
||||
|
||||
template <class Writer, class T, class Enable = std::enable_if_t<std::is_enum<T>::value>>
|
||||
template <class Writer, class T, class Enable = std::enable_if_t<std::is_enum_v<T>>>
|
||||
void stringify(Writer& writer, const T& v) {
|
||||
writer.String(Enum<T>::toString(v));
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ struct SignatureType<R (T::*)(Params...) const>
|
||||
{ using Type = R (Params...); };
|
||||
|
||||
template <class Lambda>
|
||||
struct SignatureType<Lambda, std::enable_if_t<std::is_class<Lambda>::value>>
|
||||
struct SignatureType<Lambda, std::enable_if_t<std::is_class_v<Lambda>>>
|
||||
{ using Type = typename SignatureType<decltype(&Lambda::operator())>::Type; };
|
||||
|
||||
template <typename Fn>
|
||||
|
||||
@@ -279,12 +279,12 @@ optional<Rotation> ValueConverter<Rotation>::fromExpressionValue(const Value& v)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
Value ValueConverter<T, std::enable_if_t< std::is_enum<T>::value >>::toExpressionValue(const T& value) {
|
||||
Value ValueConverter<T, std::enable_if_t< std::is_enum_v<T>>>::toExpressionValue(const T& value) {
|
||||
return std::string(Enum<T>::toString(value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
optional<T> ValueConverter<T, std::enable_if_t< std::is_enum<T>::value >>::fromExpressionValue(const Value& value) {
|
||||
optional<T> ValueConverter<T, std::enable_if_t<std::is_enum_v<T>>>::fromExpressionValue(const Value& value) {
|
||||
return value.match(
|
||||
[&] (const std::string& v) { return Enum<T>::toEnum(v); },
|
||||
[&] (const auto&) { return optional<T>(); }
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
const std::string& assetPath,
|
||||
float pixelRatio = 1,
|
||||
MapMode mode = MapMode::Static,
|
||||
typename std::enable_if<std::is_same<T, MainResourceLoader>::value>::type* = nullptr)
|
||||
typename std::enable_if_t<std::is_same_v<T, MainResourceLoader>>* = nullptr)
|
||||
: fileSource(std::make_shared<T>(ResourceOptions().withCachePath(cachePath).withAssetPath(assetPath), ClientOptions())),
|
||||
frontend(pixelRatio),
|
||||
map(frontend,
|
||||
|
||||
Reference in New Issue
Block a user