Skip to content

Commit

Permalink
Complete ponder::Value's comparison operators
Browse files Browse the repository at this point in the history
  • Loading branch information
shierei committed Jan 10, 2019
1 parent 546eb8d commit d8533b2
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions include/ponder/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

1 comment on commit d8533b2

@shierei
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code change is to complete the comparison operators for ponder::Value as discussed in the Issues thread #105.

Please sign in to comment.