33 #include <itpp/itexports.h>
63 bin(
const int &
value): b(static_cast<char>(value)) {
65 "bin::bin(): value must be 0 or 1");
74 "bin::operator=(): value must be 0 or 1");
75 b =
static_cast<char>(
value);
141 operator short()
const {
return static_cast<short>(b); }
143 operator int()
const {
return static_cast<int>(b); }
145 operator bool()
const {
return b != 0; }
147 operator float()
const {
return static_cast<float>(b); }
149 operator double()
const {
return static_cast<double>(b); }
162 ITPP_EXPORT std::ostream &
operator<<(std::ostream &output,
const bin &inbin);
168 ITPP_EXPORT std::istream &
operator>>(std::istream &input, bin &outbin);
190 #endif // #ifndef BINARY_H