Skip to content

Commit

Permalink
update iguana for gcc8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacyking committed Aug 29, 2023
1 parent eb9e436 commit 00a9d11
Show file tree
Hide file tree
Showing 5 changed files with 376 additions and 379 deletions.
11 changes: 11 additions & 0 deletions iguana/enum_reflection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#include "frozen/unordered_map.h"

namespace iguana {

#if defined(__clang__) || defined(_MSC_VER) || \
(defined(__GNUC__) && __GNUC__ > 8)

template <typename T> constexpr std::string_view get_raw_name() {
#ifdef _MSC_VER
return __FUNCSIG__;
Expand Down Expand Up @@ -130,13 +134,17 @@ get_str_to_enum_map(const std::array<std::string_view, N> &enum_names,
{enum_names[Is], enum_values[Is]}...};
}

#endif

// the default generic enum_value
// if the user has not defined a specialization template, this will be called
template <typename T> struct enum_value {
constexpr static std::array<int, 0> value = {};
};

template <bool str_to_enum, typename E> constexpr inline auto get_enum_map() {
#if defined(__clang__) || defined(_MSC_VER) || \
(defined(__GNUC__) && __GNUC__ > 8)
constexpr auto &arr = enum_value<E>::value;
constexpr auto arr_size = arr.size();
if constexpr (arr_size > 0) {
Expand All @@ -156,6 +164,9 @@ template <bool str_to_enum, typename E> constexpr inline auto get_enum_map() {
} else {
return false;
}
#else
return false;
#endif
}

#if defined(__clang__) && (__clang_major__ >= 17)
Expand Down
Loading

0 comments on commit 00a9d11

Please sign in to comment.