Skip to content

Commit

Permalink
also decay type inside of as<T> and is<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Apr 23, 2024
1 parent 28f157b commit 3fe4752
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/matjson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ namespace matjson {
return as_int();
} else if constexpr (std::is_floating_point_v<T>) {
return as_double();
} else if constexpr (requires(const Value& json) { Serialize<T>::from_json(json); }) {
return Serialize<T>::from_json(*this);
} else if constexpr (requires(const Value& json) { Serialize<std::decay_t<T>>::from_json(json); }) {
return Serialize<std::decay_t<T>>::from_json(*this);
} else if constexpr (std::is_same_v<T, Array>) {
return as_array();
} else if constexpr (std::is_same_v<T, Object>) {
Expand All @@ -173,8 +173,8 @@ namespace matjson {

template <class T>
bool is() const {
if constexpr (requires(const Value& json) { Serialize<T>::is_json(json); }) {
return Serialize<T>::is_json(*this);
if constexpr (requires(const Value& json) { Serialize<std::decay_t<T>>::is_json(json); }) {
return Serialize<std::decay_t<T>>::is_json(*this);
}
if constexpr (std::is_same_v<T, Value>) {
return true;
Expand Down

0 comments on commit 3fe4752

Please sign in to comment.