// // XBool.hpp // CloverX64 // // Created by Jief on 27/09/2021. // #ifndef XBool_hpp #define XBool_hpp #include #include "XToolsCommon.h" class XBool; template struct _xtools__is_xbool_st : public _xtools__false_type {}; template <> struct _xtools__is_xbool_st : public _xtools__true_type {}; #define is_xbool(x) _xtools__is_xbool_st::value class XBool { bool value; public: constexpr XBool() : value(false) {} //explicit XBool(const bool other) { value = other; } constexpr XBool(bool other) : value(other) {} constexpr XBool(const XBool& other) : value(other.value) {} template XBool(T other) = delete; ~XBool() {}; XBool& operator= (const XBool& other) { value = other.value; return *this; } XBool& operator= (const bool other) { value = other; return *this; } template XBool& operator= (const T other) = delete; operator bool() const { return value; } bool operator == (bool other) const { return value == other; } bool operator == (XBool other) const { return value == other.value; } template bool operator == (T other) const = delete; bool operator != (bool other) const { return value != other; } bool operator != (XBool other) const { return value != other.value; } template bool operator != (XBool other) const = delete; XBool& operator |= (bool other) { value |= other; return *this; } XBool& operator |= (XBool other) { value |= other.value; return *this; } template XBool& operator |= (XBool other) = delete; }; #endif /* XBool_hpp */