From d8533b2d55fc4a9dbe0aee36cd3cef43eb995f0c Mon Sep 17 00:00:00 2001 From: Shie-rei Huang Date: Thu, 10 Jan 2019 15:49:47 -0800 Subject: [PATCH 1/3] Complete ponder::Value's comparison operators --- include/ponder/value.hpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/ponder/value.hpp b/include/ponder/value.hpp index 206ea0e9..4611858a 100644 --- a/include/ponder/value.hpp +++ b/include/ponder/value.hpp @@ -218,6 +218,42 @@ class PONDER_API Value */ bool operator < (const Value& other) const; + /** + * \brief Operator > to compare two values + * + * \param other Value to compare with this + * + * \return True if this > other + */ + bool operator > (const Value& other) const + { + return !(*this < other || *this == other); + } + + /** + * \brief Operator <= to compare two values + * + * \param other Value to compare with this + * + * \return True if this <= other + */ + bool operator <= (const Value& other) const + { + return (*this < other || *this == other); + } + + /** + * \brief Operator >= to compare two values + * + * \param other Value to compare with this + * + * \return True if this >= other + */ + bool operator >= (const Value& other) const + { + return !(*this < other); + } + /** * \brief Special Value instance representing an empty value */ From a87a4527fab1ee92a29d28307e1e262bd3ab6a0e Mon Sep 17 00:00:00 2001 From: Shie-rei Huang Date: Thu, 10 Jan 2019 16:47:53 -0800 Subject: [PATCH 2/3] Fixed a bug that getter of a user defined type might return garbage. --- include/ponder/detail/userpropertyimpl.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ponder/detail/userpropertyimpl.inl b/include/ponder/detail/userpropertyimpl.inl index 62fb236e..256408df 100644 --- a/include/ponder/detail/userpropertyimpl.inl +++ b/include/ponder/detail/userpropertyimpl.inl @@ -69,7 +69,7 @@ UserPropertyImpl::UserPropertyImpl(IdRef name, A&& accessor) template Value UserPropertyImpl::getValue(const UserObject& object) const { - return ToUserObject::get( + return ToUserObject::get( m_accessor.m_interface.getter(object.get())); } From db0e15c4114e38aee08b0a622bdec914d1be56c4 Mon Sep 17 00:00:00 2001 From: Shie-rei Huang Date: Fri, 25 Jan 2019 17:38:29 -0800 Subject: [PATCH 3/3] support pointer type arguments --- include/ponder/detail/propertyfactory.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/ponder/detail/propertyfactory.hpp b/include/ponder/detail/propertyfactory.hpp index d9e62550..c75e77d3 100644 --- a/include/ponder/detail/propertyfactory.hpp +++ b/include/ponder/detail/propertyfactory.hpp @@ -197,10 +197,16 @@ struct AccessTraits::isArr * User objects. * - I.e. Registered classes. * - Enums also use registration so must differentiate. + * - Pointer to basic types, such as std::string, integers and floats + * also use registration. They must differentiate also. */ template struct AccessTraits() && !std::is_enum::value>::type> + typename std::enable_if() && + !std::is_same::value && + !std::is_integral::value && + !std::is_floating_point::value && + !std::is_enum::value>::type> { static constexpr PropertyAccessKind kind = PropertyAccessKind::User;