IT++ Logo
binary.cpp
Go to the documentation of this file.
00001 
00029 #include <itpp/base/binary.h>
00030 #include <iostream>
00031 
00032 
00033 namespace itpp
00034 {
00035 
00036 std::ostream &operator<<(std::ostream &output, const bin &inbin)
00037 {
00038   output << static_cast<int>(inbin);
00039   return output;
00040 }
00041 
00042 std::istream &operator>>(std::istream &input, bin &outbin)
00043 {
00044   int tmp;
00045   input >> tmp;
00046   it_assert((tmp == 0) || (tmp == 1),
00047             "bin::operator>>(): input value must be 0 or 1");
00048   outbin = tmp;
00049   return input;
00050 }
00051 
00052 } // namespace itpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SourceForge Logo

Generated on Wed Jul 27 2011 16:27:04 for IT++ by Doxygen 1.7.4