Skip to content

Commit

Permalink
Update Json.cppm
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuria-Shikibe committed May 5, 2024
1 parent 2f26ffe commit a9942bf
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/arc/util/Json.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export namespace ext::json{
}


enum struct JsonValueTag : std::size_t{
enum struct JsonValueTag : std::size_t {
arithmetic_int,
arithmetic_float,
boolean,
Expand Down Expand Up @@ -313,16 +313,14 @@ export namespace ext::json{
return std::get_if<T>(&data);
}

template <JsonValueTag t>
requires requires{ requires static_cast<size_t>(t) < std::variant_size_v<decltype(data)>; }
[[nodiscard]] constexpr TypeAt<static_cast<size_t>(t)>* tryGetValue() noexcept{
return std::get_if<static_cast<size_t>(t)>(&data);
template <JsonValueTag tag>
[[nodiscard]] constexpr TypeAt<static_cast<size_t>(tag)>* tryGetValue() noexcept{
return std::get_if<static_cast<size_t>(tag)>(&data);
}

template <JsonValueTag t>
requires requires{ requires static_cast<size_t>(t) < std::variant_size_v<decltype(data)>; }
[[nodiscard]] constexpr const TypeAt<static_cast<size_t>(t)>* tryGetValue() const noexcept{
return std::get_if<static_cast<size_t>(t)>(&data);
template <JsonValueTag tag>
[[nodiscard]] constexpr const TypeAt<static_cast<size_t>(tag)>* tryGetValue() const noexcept{
return std::get_if<static_cast<size_t>(tag)>(&data);
}

/**
Expand Down

0 comments on commit a9942bf

Please sign in to comment.