Does this look like it will serve its purpose well. I just hate that the C++ bool can't be used in containers so I decided to write my own that is more C++ish, and that is safe for containers. Tell me if i am missing anything.
I realize most of you will think this is pointless if not all of you, but I don't #define for stuff like this, and I think this will work better for my purposes.
EDIT: Added operator*() function. Little easier to type, little harder to read(understand). Oh well.Code:class Bool { public: //Default constructor Bool(unsigned char initVal=0) { if ( initVal == Bool::TRUE ) ThisBool = new unsigned char(0); if ( initVal >= Bool::FALSE || initVal == Bool::FALSE) ThisBool = new unsigned char(1); }; //Copy constructor Bool(const Bool& copy) { if ( copy.ThisBool ) { this->ThisBool = new unsigned char(*copy.ThisBool); delete copy.ThisBool; } else { this->ThisBool = new unsigned char(Bool::TRUE); } }; //default destructor ~Bool () { delete ThisBool; }; //Enumeration for Bool values enum TYPE { TRUE = 0, FALSE = 1 }; //Duh? const bool True() { if ( *ThisBool == Bool::TRUE ) return true; else return false; }; //Duh? const bool False() { if ( *ThisBool == Bool::FALSE ) return true; else return false; }; //Get the value of the Bool without changing it const unsigned char& Get() { return *ThisBool; }; //Get the value of the Bool without changing it const unsigned char& operator*() { return *ThisBool; }; //Toggle the value of the Bool const unsigned char& Toggle() { if ( *ThisBool == Bool::TRUE ) { *ThisBool = Bool::FALSE; return *ThisBool; } else { *ThisBool = Bool::TRUE; return *ThisBool; } }; //Set the value of the Bool const unsigned char& Set(TYPE new_val) { *ThisBool = new_val; return *ThisBool; }; private: unsigned char* ThisBool; };