summaryrefslogtreecommitdiff
path: root/include/mbgl/util/traits.hpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-04-28 18:24:24 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-04-28 18:55:55 +0300
commit1f5587b3ea23d03364107f39b24ff16545d04dd7 (patch)
tree9c6c5690c9494389ecf66f00c6b94e301fae7864 /include/mbgl/util/traits.hpp
parentffb59864dc04e235c898465dbcb8250ff776a7c9 (diff)
downloadqtlocation-mapboxgl-1f5587b3ea23d03364107f39b24ff16545d04dd7.tar.gz
[core] Added mbgl::underlying_type
Diffstat (limited to 'include/mbgl/util/traits.hpp')
-rw-r--r--include/mbgl/util/traits.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/mbgl/util/traits.hpp b/include/mbgl/util/traits.hpp
new file mode 100644
index 0000000000..812d9fb547
--- /dev/null
+++ b/include/mbgl/util/traits.hpp
@@ -0,0 +1,15 @@
+#ifndef MBGL_UTIL_TRAITS
+#define MBGL_UTIL_TRAITS
+
+#include <type_traits>
+
+namespace mbgl {
+
+template<typename T>
+constexpr auto underlying_type(T t) -> typename std::underlying_type<T>::type {
+ return static_cast<typename std::underlying_type<T>::type>(t);
+}
+
+} // namespace mbgl
+
+#endif // MBGL_UTIL_TRAITS