#ifndef ALREADY_INCLUDED_2006_LIBD_BOOLEAN_HH
#define ALREADY_INCLUDED_2006_LIBD_BOOLEAN_HH
#include "libd.hh"
namespace dmp
{
NOTE: size = 4 + 12 = 16 class Boolean : private Single
{
public:
bool v;
private:
Boolean(bool v) : Single(DCODE_BOOLEAN)
{
this->v = v;
}
public:
static ptr<Boolean> ctor()
{
return new Boolean(false);
}
static ptr<Boolean> ctor(bool v)
{
return new Boolean(v);
}
private:
NOTE: opens up ~Boolean() to ptr class template <class T> friend class ptr;
~Boolean()
{
NOTE: do nothing }
#ifdef DAVINS_IO_ONLINE
friend dmp::Writer& operator << (dmp::Writer& w, Boolean& ba)
{
w << ba.v;
return w;
}
#endif
NOTE: disables passing and returning by value private:
Boolean(const Boolean&);
Boolean& operator = (const Boolean&);
friend bool operator == (const Boolean& b1, const Boolean& b2)
{
return b1.v == b2.v;
}
friend bool operator != (const Boolean& b1, const Boolean& b2)
{
return b1.v != b2.v;
}
};
}
#endif