MSVC SFINAE compatibility

This commit is contained in:
Tom Lankhorst 2019-02-01 15:50:09 +01:00
parent 1a81d60609
commit 2ea347f15f
No known key found for this signature in database
GPG Key ID: 52BF82B885592251
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,30 @@
/*****************************************************************************
* Copyright (c) 2014-2019 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include <type_traits>
namespace Meta
{
/**
* Meta function for checking that all Conditions are true types.
*/
template<typename... Conditions> struct all : std::true_type
{
};
template<typename Condition, typename... Conditions>
struct all<Condition, Conditions...> : std::conditional<Condition::value, all<Conditions...>, std::false_type>::type
{
};
template<typename Type, typename... Types> using all_convertible = all<std::is_convertible<Types, Type>...>;
} // namespace Meta

View File

@ -9,6 +9,7 @@
#pragma once
#include "Meta.hpp"
#include "Numerics.hpp"
#include <algorithm>
@ -41,7 +42,7 @@ namespace Random
template<
typename... T, typename std::enable_if<sizeof...(T) == N, int>::type = 0,
typename std::enable_if<(std::is_convertible<T, result_type>::value && ...), int>::type = 0>
typename std::enable_if<Meta::all_convertible<result_type, T...>::value, int>::type = 0>
explicit FixedSeedSequence(T... s)
: v{ static_cast<result_type>(s)... }
{