binary.cpp
Go to the documentation of this file.
#include <itpp/base/binary.h>
#include <iostream>
namespace itpp
{
std::ostream &operator<<(std::ostream &output, const bin &inbin)
{
output << static_cast<int>(inbin);
return output;
}
std::istream &operator>>(std::istream &input, bin &outbin)
{
int tmp;
input >> tmp;
it_assert((tmp == 0) || (tmp == 1),
"bin::operator>>(): input value must be 0 or 1");
outbin = tmp;
return input;
}
} // namespace itpp
binary.h
Binary class definition.
itpp::Array
General array class.
Definition array.h:105
itpp::bin
Binary arithmetic (boolean) class.
Definition binary.h:57
it_assert
#define it_assert(t, s)
Abort if t is not true.
Definition itassert.h:94
itpp
itpp namespace
Definition itmex.h:37
itpp::operator<<
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
Definition binary.cpp:36
itpp::operator>>
std::istream & operator>>(std::istream &input, bin &outbin)
Input stream of bin.
Definition binary.cpp:42

Generated on Mon Jun 10 2024 11:49:16 for IT++ by Doxygen 1.9.8