Skip to content

Commit

Permalink
Merge pull request #269 from qicosmos/fix_compile_flag
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored May 5, 2024
2 parents 3b33bb0 + 9da039d commit 738bf48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions iguana/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ IGUANA_INLINE void write_string_with_escape(const Ch* it, SizeType length,
}

template <typename T, size_t N>
IGUANA_INLINE constexpr bool has_duplicate(std::array<T, N>& arr) {
IGUANA_INLINE constexpr bool has_duplicate(const std::array<T, N>& arr) {
for (int i = 0; i < arr.size(); i++) {
for (int j = i + 1; j < arr.size(); j++) {
if (arr[i] == arr[j]) {
Expand All @@ -313,7 +313,8 @@ IGUANA_INLINE constexpr bool has_duplicate(std::array<T, N>& arr) {
return false;
}

#if (__GNUC__ > 8)
#if defined(__clang__) || defined(_MSC_VER) || \
(defined(__GNUC__) && __GNUC__ > 8)
template <typename... Types>
IGUANA_INLINE constexpr bool has_duplicate_type() {
std::array<std::string_view, sizeof...(Types)> arr{
Expand Down
3 changes: 2 additions & 1 deletion test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ struct nest_t {
REFLECTION(nest_t, name, value, var, var2);

TEST_CASE("test throw while parsing an illegal number") {
#if (__GNUC__ > 8)
#if defined(__clang__) || defined(_MSC_VER) || \
(defined(__GNUC__) && __GNUC__ > 8)
constexpr bool r = iguana::has_duplicate_type_v<std::variant<int, bool>>;
constexpr bool r1 =
iguana::has_duplicate_type_v<std::variant<int, bool, bool>>;
Expand Down

0 comments on commit 738bf48

Please sign in to comment.