Skip to content

Commit 16b50c3

Browse files
committed
Fix As<> for cvref types
1 parent 703ac4c commit 16b50c3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cppjson/include/cppjson/object.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ namespace cppjson
6767
Object& operator=(Object&&) = default;
6868
~Object() = default;
6969

70+
[[nodiscard]] bool IsEmpty() const noexcept { return this->_nodes.empty(); }
71+
7072
class ObjectProxy
7173
{
7274
public:
@@ -76,14 +78,14 @@ namespace cppjson
7678
requires(!std::same_as<std::remove_cvref_t<T>, JsonObject>)
7779
explicit(false) operator T&()
7880
{
79-
return this->_object.get().As<T>();
81+
return this->_object.get().As<std::remove_cvref_t<T>>();
8082
}
8183

8284
template <typename T>
8385
requires(!std::same_as<std::remove_cvref_t<T>, JsonObject>)
8486
explicit(false) operator const T&() const
8587
{
86-
return this->_object.get().As<T>();
88+
return this->_object.get().As<const std::remove_cvref_t<T>>();
8789
}
8890

8991
template <typename T>

0 commit comments

Comments
 (0)