[core] Added MBGL_CONSTEXPR to satisfy GCC 4.9
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/util/util.hpp>
|
||||
#include <mbgl/util/traits.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
@@ -51,23 +52,23 @@ enum class MapDebugOptions : EnumType {
|
||||
#endif // MBGL_USE_GLES2
|
||||
};
|
||||
|
||||
constexpr MapDebugOptions operator|(MapDebugOptions lhs, MapDebugOptions rhs) {
|
||||
MBGL_CONSTEXPR MapDebugOptions operator|(MapDebugOptions lhs, MapDebugOptions rhs) {
|
||||
return MapDebugOptions(mbgl::underlying_type(lhs) | mbgl::underlying_type(rhs));
|
||||
}
|
||||
|
||||
constexpr MapDebugOptions& operator|=(MapDebugOptions& lhs, MapDebugOptions rhs) {
|
||||
MBGL_CONSTEXPR MapDebugOptions& operator|=(MapDebugOptions& lhs, MapDebugOptions rhs) {
|
||||
return (lhs = MapDebugOptions(mbgl::underlying_type(lhs) | mbgl::underlying_type(rhs)));
|
||||
}
|
||||
|
||||
constexpr bool operator&(MapDebugOptions lhs, MapDebugOptions rhs) {
|
||||
MBGL_CONSTEXPR bool operator&(MapDebugOptions lhs, MapDebugOptions rhs) {
|
||||
return mbgl::underlying_type(lhs) & mbgl::underlying_type(rhs);
|
||||
}
|
||||
|
||||
constexpr MapDebugOptions& operator&=(MapDebugOptions& lhs, MapDebugOptions rhs) {
|
||||
MBGL_CONSTEXPR MapDebugOptions& operator&=(MapDebugOptions& lhs, MapDebugOptions rhs) {
|
||||
return (lhs = MapDebugOptions(mbgl::underlying_type(lhs) & mbgl::underlying_type(rhs)));
|
||||
}
|
||||
|
||||
constexpr MapDebugOptions operator~(MapDebugOptions value) {
|
||||
MBGL_CONSTEXPR MapDebugOptions operator~(MapDebugOptions value) {
|
||||
return MapDebugOptions(~mbgl::underlying_type(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <mbgl/util/util.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
@@ -7,7 +9,7 @@ namespace util {
|
||||
|
||||
template<typename To, typename From, std::size_t Size,
|
||||
typename = std::enable_if_t<std::is_convertible<From, To>::value>>
|
||||
constexpr std::array<To, Size> convert(const std::array<From, Size>&from) {
|
||||
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));
|
||||
return to;
|
||||
|
||||
@@ -12,3 +12,10 @@
|
||||
#define MBGL_VERIFY_THREAD(tid)
|
||||
|
||||
#endif
|
||||
|
||||
// GCC 4.9 compatibility
|
||||
#if !defined(__GNUC__) || __GNUC__ >= 5
|
||||
#define MBGL_CONSTEXPR constexpr
|
||||
#else
|
||||
#define MBGL_CONSTEXPR inline
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user