xtd 0.2.0
iequatable.h
Go to the documentation of this file.
1 #pragma once
5 #include "interface.h"
6 
8 namespace xtd {
9  template<typename type_t>
19  public:
21 
26  virtual bool equals(const type_t&) const noexcept = 0;
28 
30  friend bool operator ==(const type_t& a, const type_t& b) noexcept {return a.equals(b);}
31  friend bool operator !=(const type_t& a, const type_t& b) noexcept {return !a.equals(b);}
32  template<typename object_t>
33  friend bool operator ==(const type_t& a, const iequatable<object_t>& b) noexcept {return dynamic_cast<const type_t*>(&b) && a.equals(dynamic_cast<const type_t&>(b));}
34  template<typename object_t>
35  friend bool operator !=(const type_t& a, const iequatable<object_t>& b) noexcept {return !dynamic_cast<const type_t*>(&b) || !a.equals(dynamic_cast<const type_t&>(b));}
37  };
38 }
virtual bool equals(const type_t &) const noexcept=0
Indicates whether the current object is equal to another object of the same type. ...
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::interface interface.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
#define interface_
This keyword is use to represent an interface.
Definition: interface.h:55