IT++ Logo
binary.cpp
Go to the documentation of this file.
1
29#include <itpp/base/binary.h>
30#include <iostream>
31
32
33namespace itpp
34{
35
36std::ostream &operator<<(std::ostream &output, const bin &inbin)
37{
38 output << static_cast<int>(inbin);
39 return output;
40}
41
42std::istream &operator>>(std::istream &input, bin &outbin)
43{
44 int tmp;
45 input >> tmp;
46 it_assert((tmp == 0) || (tmp == 1),
47 "bin::operator>>(): input value must be 0 or 1");
48 outbin = tmp;
49 return input;
50}
51
52} // namespace itpp
Binary class definition.
Binary arithmetic (boolean) class.
Definition binary.h:57
#define it_assert(t, s)
Abort if t is not true.
Definition itassert.h:94
itpp namespace
Definition itmex.h:37
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
Definition binary.cpp:36
std::istream & operator>>(std::istream &input, bin &outbin)
Input stream of bin.
Definition binary.cpp:42
SourceForge Logo

Generated on Mon Apr 7 2025 07:53:18 for IT++ by Doxygen 1.11.0