summaryrefslogtreecommitdiff
path: root/include/mbgl/map/mode.hpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-17 12:18:39 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-18 20:23:00 +0300
commit41497e9c4174d310f3a62548f3cfeb9da2852849 (patch)
treeae3e0fc54f10cba24f61bf22c440d45c87c9441a /include/mbgl/map/mode.hpp
parent0006c9c27542da2f262e7bc105999f3072e4b6f2 (diff)
downloadqtlocation-mapboxgl-41497e9c4174d310f3a62548f3cfeb9da2852849.tar.gz
[core] Cleaned up enum classes
- Replaced static_cast with C++ casts. - Replaced inline with constexpr.
Diffstat (limited to 'include/mbgl/map/mode.hpp')
-rw-r--r--include/mbgl/map/mode.hpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/mbgl/map/mode.hpp b/include/mbgl/map/mode.hpp
index 074bc3f08e..80ba4d7563 100644
--- a/include/mbgl/map/mode.hpp
+++ b/include/mbgl/map/mode.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include <mbgl/util/traits.hpp>
+
#include <cstdint>
namespace mbgl {
@@ -48,17 +50,16 @@ enum class MapDebugOptions : EnumType {
#endif // GL_ES_VERSION_2_0
};
-inline MapDebugOptions operator| (const MapDebugOptions& lhs, const MapDebugOptions& rhs) {
- return MapDebugOptions(static_cast<EnumType>(lhs) | static_cast<EnumType>(rhs));
+constexpr MapDebugOptions operator|(MapDebugOptions lhs, MapDebugOptions rhs) {
+ return MapDebugOptions(mbgl::underlying_type(lhs) | mbgl::underlying_type(rhs));
}
-inline MapDebugOptions& operator|=(MapDebugOptions& lhs, const MapDebugOptions& rhs) {
- lhs = lhs | rhs;
- return lhs;
+constexpr MapDebugOptions& operator|=(MapDebugOptions& lhs, MapDebugOptions rhs) {
+ return (lhs = lhs | rhs);
}
-inline bool operator& (const MapDebugOptions& lhs, const MapDebugOptions& rhs) {
- return static_cast<EnumType>(lhs) & static_cast<EnumType>(rhs);
+constexpr bool operator&(MapDebugOptions lhs, MapDebugOptions rhs) {
+ return mbgl::underlying_type(lhs) & mbgl::underlying_type(rhs);
}
} // namespace mbgl