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
SourceForge Logo

Generated on Sat Jul 6 2013 10:54:19 for IT++ by Doxygen 1.8.2