diff options
-rw-r--r-- | chilbert/BigBitVec.hpp | 10 | ||||
-rw-r--r-- | chilbert/FixBitVec.hpp | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/chilbert/BigBitVec.hpp b/chilbert/BigBitVec.hpp index 8f8dc6d..37ef870 100644 --- a/chilbert/BigBitVec.hpp +++ b/chilbert/BigBitVec.hpp @@ -26,6 +26,7 @@ #include <cstddef> #include <cstdlib> #include <cstring> +#include <iostream> #include <memory> #define FBVS_NEEDED(b) ((std::max(b, size_t(1)) + FBV_BITS - 1) / FBV_BITS) @@ -541,6 +542,15 @@ grayCodeInv(CBigBitVec& value) } } +inline std::ostream& +operator<<(std::ostream& os, const CBigBitVec& vec) +{ + for (size_t i = 0; i < vec.size(); ++i) { + os << vec.test(vec.size() - i - 1); + } + return os; +} + } // namespace chilbert #endif diff --git a/chilbert/FixBitVec.hpp b/chilbert/FixBitVec.hpp index bba25d9..0bc2032 100644 --- a/chilbert/FixBitVec.hpp +++ b/chilbert/FixBitVec.hpp @@ -25,6 +25,7 @@ #include <climits> #include <cstddef> #include <cstdint> +#include <iostream> namespace chilbert { @@ -266,6 +267,15 @@ grayCodeInv(CFixBitVec& value) grayCodeInv<FBV_UINT>(value.rack()); } +inline std::ostream& +operator<<(std::ostream& os, const CFixBitVec& vec) +{ + for (size_t i = 0; i < vec.size(); ++i) { + os << vec.test(vec.size() - i - 1); + } + return os; +} + } // namespace chilbert #endif |