1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00

constexpr_for not work on vs2017

This commit is contained in:
neargye 2021-10-09 02:40:44 +03:00
parent 018673a0a4
commit c7a0c83ed4
2 changed files with 17 additions and 1 deletions

View file

@ -974,6 +974,12 @@ TEST_CASE("cmp_less") {
}
}
#if defined(__clang__) && __clang_major__ >= 5 || defined(__GNUC__) && __GNUC__ >= 9 || defined(_MSC_VER) && _MSC_VER >= 1920
# define MAGIC_ENUM_SUPPORTED_CONSTEXPR_FOR 1
#endif
#if defined(MAGIC_ENUM_SUPPORTED_CONSTEXPR_FOR)
// from https://artificial-mind.net/blog/2020/10/31/constexpr-for
template <auto Start, auto End, auto Inc, class F>
constexpr void constexpr_for(F&& f) {
@ -995,3 +1001,5 @@ TEST_CASE("constexpr_for") {
[[maybe_unused]] Foo<Numbers, magic_enum::enum_value<Numbers, i>()> bar{};
});
}
#endif

View file

@ -691,6 +691,12 @@ TEST_CASE("bitwise_operators") {
}
}
#if defined(__clang__) && __clang_major__ >= 5 || defined(__GNUC__) && __GNUC__ >= 9 || defined(_MSC_VER) && _MSC_VER >= 1920
# define MAGIC_ENUM_SUPPORTED_CONSTEXPR_FOR 1
#endif
#if defined(MAGIC_ENUM_SUPPORTED_CONSTEXPR_FOR)
// from https://artificial-mind.net/blog/2020/10/31/constexpr-for
template <auto Start, auto End, auto Inc, class F>
constexpr void constexpr_for(F&& f) {
@ -707,4 +713,6 @@ TEST_CASE("constexpr_for") {
constexpr_for<0, magic_enum::enum_count<Color>(), 1>([](auto i) {
[[maybe_unused]] Foo<Color, magic_enum::enum_value<Color, i>()> bar{};
});
}
}
#endif