diff options
Diffstat (limited to 'chilbert/Operators.hpp')
-rw-r--r-- | chilbert/Operators.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chilbert/Operators.hpp b/chilbert/Operators.hpp index 9ae022a..683c792 100644 --- a/chilbert/Operators.hpp +++ b/chilbert/Operators.hpp @@ -21,6 +21,7 @@ #include "chilbert/Traits.hpp" +#include <iostream> #include <type_traits> namespace chilbert { @@ -78,6 +79,16 @@ operator>>(const T& vec, const size_t bits) return r; } +template <class T> +inline std::enable_if_t<is_bitvec_v<T>, std::ostream>& +operator<<(std::ostream& os, const T& vec) +{ + for (size_t i = 0; i < vec.size(); ++i) { + os << vec.test(vec.size() - i - 1); + } + return os; +} + } // namespace chilbert #endif |