xtd 0.2.0
Loading...
Searching...
No Matches
iequatable.h
Go to the documentation of this file.
1
4#pragma once
5#include "interface.h"
6
8namespace 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}
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:18
virtual bool equals(const type_t &) const noexcept=0
Indicates whether the current object is equal to another object of the same type.
#define interface_
This keyword is use to represent an interface.
Definition interface.h:58
@ a
The A key.
@ b
The B key.
Contains xtd::interface interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10