diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2018-05-09 00:11:35 +0200 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2018-05-09 00:11:35 +0200 |
commit | 015bb675d6eb177900c8ac94a6d35edc5ad90576 (patch) | |
tree | edde4153ce9b2ba6bdaf9d3c0af0966ed6dfd717 /zen/optional.h | |
parent | 9.8 (diff) | |
download | FreeFileSync-015bb675d6eb177900c8ac94a6d35edc5ad90576.tar.gz FreeFileSync-015bb675d6eb177900c8ac94a6d35edc5ad90576.tar.bz2 FreeFileSync-015bb675d6eb177900c8ac94a6d35edc5ad90576.zip |
9.9
Diffstat (limited to 'zen/optional.h')
-rwxr-xr-x | zen/optional.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/zen/optional.h b/zen/optional.h index 0ef5f1db..88928ac0 100755 --- a/zen/optional.h +++ b/zen/optional.h @@ -7,7 +7,7 @@ #ifndef OPTIONAL_H_2857428578342203589 #define OPTIONAL_H_2857428578342203589 -#include <cassert> +//#include <cassert> #include <type_traits> @@ -96,6 +96,20 @@ private: std::aligned_storage_t<sizeof(T), alignof(T)> rawMem_; //don't require T to be default-constructible! bool valid_ = false; }; + + +template <class T> inline +bool operator==(const Opt<T>& lhs, const Opt<T>& rhs) +{ + if (static_cast<bool>(lhs) != static_cast<bool>(rhs)) + return false; + if (!lhs) + return true; + return *lhs == *rhs; +} +template <class T> inline +bool operator!=(const Opt<T>& lhs, const Opt<T>& rhs) { return !(lhs == rhs); } + } #endif //OPTIONAL_H_2857428578342203589 |