PolyBoRi
BooleConstant.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
28 //*****************************************************************************
29 
30 // include basic definitions
31 #include "pbori_defs.h"
32 
33 #ifndef BooleConstant_h_
34 #define BooleConstant_h_
35 
37 
48 
49 public:
51  BooleConstant(): m_value(false) {}
52 
54  BooleConstant(bool value): m_value(value) {}
55 
57  BooleConstant(int value): m_value(value % 2) {}
58 
60  operator bool() const { return m_value; }
61 
63  BooleConstant operator!() const { return !m_value; }
64 
65 protected:
67  const bool m_value;
68 };
69 
71 inline CTypes::ostream_type&
73  return (os << (int) rhs);
74 }
75 
76 
78 
79 #endif // BooleConstant_h_