Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Sep 20, 2024
1 parent 9a3025b commit 5db57d2
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/xtd.core/include/xtd/comparison_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,37 @@ namespace xtd {
/// @param lhs The left hand side value to compare.
/// @param rhs The right hand side value to compare.
/// @return true if lhs less than rhs; otherwise false.
friend bool operator <(const type_t& lhs, const type_t& rhs) noexcept {return dynamic_cast<const type_t*>(&rhs) && lhs.compare_to(static_cast<const type_t&>(rhs)) < 0;}
friend bool operator <(const type_t& lhs, const type_t& rhs) noexcept {
auto rhs_ptr = &rhs;
return dynamic_cast<const type_t*>(rhs_ptr) && lhs.compare_to(static_cast<const type_t&>(rhs)) < 0;
}

/// @brief Less than or equal to comparison operator with specidied lhs ans rhs values.
/// @param lhs The left hand side value to compare.
/// @param rhs The right hand side value to compare.
/// @return true if lhs less than or equal to rhs; otherwise false.
friend bool operator <=(const type_t& lhs, const type_t& rhs) noexcept {return dynamic_cast<const type_t*>(&rhs) && lhs.compare_to(static_cast<const type_t&>(rhs)) <= 0;}
friend bool operator <=(const type_t& lhs, const type_t& rhs) noexcept {
auto rhs_ptr = &rhs;
return dynamic_cast<const type_t*>(rhs_ptr) && lhs.compare_to(static_cast<const type_t&>(rhs)) <= 0;
}

/// @brief Greater than or equal to comparison operator with specidied lhs ans rhs values.
/// @param lhs The left hand side value to compare.
/// @param rhs The right hand side value to compare.
/// @return true if lhs greater than rhs; otherwise false.
friend bool operator >(const type_t& lhs, const type_t& rhs) noexcept {return dynamic_cast<const type_t*>(&rhs) && lhs.compare_to(static_cast<const type_t&>(rhs)) > 0;}
friend bool operator >(const type_t& lhs, const type_t& rhs) noexcept {
auto rhs_ptr = &rhs;
return dynamic_cast<const type_t*>(rhs_ptr) && lhs.compare_to(static_cast<const type_t&>(rhs)) > 0;
}

/// @brief Less than comparison operator with specidied lhs ans rhs values.
/// @param lhs The left hand side value to compare.
/// @param rhs The right hand side value to compare.
/// @return true if lhs greater than or equal to rhs; otherwise false.
friend bool operator >=(const type_t& lhs, const type_t& rhs) noexcept {return dynamic_cast<const type_t*>(&rhs) && lhs.compare_to(static_cast<const type_t&>(rhs)) >= 0;}
friend bool operator >=(const type_t& lhs, const type_t& rhs) noexcept {
auto rhs_ptr = &rhs;
return dynamic_cast<const type_t*>(rhs_ptr) && lhs.compare_to(static_cast<const type_t&>(rhs)) >= 0;
}

#if defined(__xtd__cpp_lib_three_way_comparison)
/// @brief Three-way comparison operator with specidied lhs ans rhs values.
Expand Down

0 comments on commit 5db57d2

Please sign in to comment.