diff options
author | Artyom Polkovnikov <artyom.polkovnikov@gmail.com> | 2014-12-30 20:27:06 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:35:55 +0300 |
commit | ae0f11125a06d163a21f621e15f12102c544a683 (patch) | |
tree | b42c545475b05c41c7472f91da27621d9437bf1d /3party/osrm | |
parent | d6e005c1fb3c6b369482aaadb9aea78982869c7c (diff) |
[std] Define and use CONSTEXPR_VALUE macro to make code compilable under MSVC 2013.
Diffstat (limited to '3party/osrm')
-rw-r--r-- | 3party/osrm/osrm-backend/Include/osrm/Coordinate.h | 4 | ||||
-rw-r--r-- | 3party/osrm/osrm-backend/ThirdParty/variant/variant.hpp | 19 |
2 files changed, 13 insertions, 10 deletions
diff --git a/3party/osrm/osrm-backend/Include/osrm/Coordinate.h b/3party/osrm/osrm-backend/Include/osrm/Coordinate.h index 462ac0b63b..e49663c204 100644 --- a/3party/osrm/osrm-backend/Include/osrm/Coordinate.h +++ b/3party/osrm/osrm-backend/Include/osrm/Coordinate.h @@ -32,7 +32,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <string> #include <type_traits> -constexpr float COORDINATE_PRECISION = 1000000.f; +#include "../../../../../std/constexpr.hpp" + +CONSTEXPR_VALUE float COORDINATE_PRECISION = 1000000.f; struct FixedPointCoordinate { diff --git a/3party/osrm/osrm-backend/ThirdParty/variant/variant.hpp b/3party/osrm/osrm-backend/ThirdParty/variant/variant.hpp index 4e3eee6e16..d919ad2c77 100644 --- a/3party/osrm/osrm-backend/ThirdParty/variant/variant.hpp +++ b/3party/osrm/osrm-backend/ThirdParty/variant/variant.hpp @@ -12,6 +12,7 @@ #include "recursive_wrapper.hpp" +#include "../../../../../std/constexpr.hpp" #include "../../../../../std/noexcept.hpp" #ifdef _MSC_VER @@ -38,7 +39,7 @@ namespace mapbox { namespace util { namespace detail { -static constexpr std::size_t invalid_value = std::size_t(-1); +static CONSTEXPR_VALUE std::size_t invalid_value = std::size_t(-1); template <typename T, typename...Types> struct direct_type; @@ -46,14 +47,14 @@ struct direct_type; template <typename T, typename First, typename...Types> struct direct_type<T, First, Types...> { - static constexpr std::size_t index = std::is_same<T, First>::value + static CONSTEXPR_VALUE std::size_t index = std::is_same<T, First>::value ? sizeof...(Types) : direct_type<T, Types...>::index; }; template <typename T> struct direct_type<T> { - static constexpr std::size_t index = invalid_value; + static CONSTEXPR_VALUE std::size_t index = invalid_value; }; template <typename T, typename...Types> @@ -62,21 +63,21 @@ struct convertible_type; template <typename T, typename First, typename...Types> struct convertible_type<T, First, Types...> { - static constexpr std::size_t index = std::is_convertible<T, First>::value + static CONSTEXPR_VALUE std::size_t index = std::is_convertible<T, First>::value ? sizeof...(Types) : convertible_type<T, Types...>::index; }; template <typename T> struct convertible_type<T> { - static constexpr std::size_t index = invalid_value; + static CONSTEXPR_VALUE std::size_t index = invalid_value; }; template <typename T, typename...Types> struct value_traits { - static constexpr std::size_t direct_index = direct_type<T, Types...>::index; - static constexpr std::size_t index = + static CONSTEXPR_VALUE std::size_t direct_index = direct_type<T, Types...>::index; + static CONSTEXPR_VALUE std::size_t index = (direct_index == invalid_value) ? convertible_type<T, Types...>::index : direct_index; }; @@ -86,7 +87,7 @@ struct is_valid_type; template <typename T, typename First, typename... Types> struct is_valid_type<T, First, Types...> { - static constexpr bool value = std::is_convertible<T, First>::value + static CONSTEXPR_VALUE bool value = std::is_convertible<T, First>::value || is_valid_type<T, Types...>::value; }; @@ -522,7 +523,7 @@ public: VARIANT_INLINE variant(T && val) NOEXCEPT_MODIFIER : type_index(detail::value_traits<typename std::remove_reference<T>::type, Types...>::index) { - constexpr std::size_t index = sizeof...(Types) - detail::value_traits<typename std::remove_reference<T>::type, Types...>::index - 1; + CONSTEXPR_VALUE std::size_t index = sizeof...(Types) - detail::value_traits<typename std::remove_reference<T>::type, Types...>::index - 1; using target_type = typename detail::select_type<index, Types...>::type; new (&data) target_type(std::forward<T>(val)); // nothrow } |