IT++ Logo
binary.cpp
Go to the documentation of this file.
1 
29 #include <itpp/base/binary.h>
30 #include <iostream>
31 
32 
33 namespace itpp
34 {
35 
36 std::ostream &operator<<(std::ostream &output, const bin &inbin)
37 {
38  output << static_cast<int>(inbin);
39  return output;
40 }
41 
42 std::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.
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
Definition: binary.cpp:36
#define it_assert(t, s)
Abort if t is not true.
Definition: itassert.h:94
itpp namespace
Definition: itmex.h:36
Binary arithmetic (boolean) class.
Definition: binary.h:56
std::istream & operator>>(std::istream &input, bin &outbin)
Input stream of bin.
Definition: binary.cpp:42

Generated on Thu Jun 21 2018 16:06:18 for IT++ by Doxygen 1.8.13