GF2::Vector — Binary Shift Operators

Methods to perform binary left and right shifts for the elements in a bit-vector where zeros are shifted in as needed.

constexpr Vector &operator<<=(std::size_t p);     (1)
constexpr Vector &operator>>=(std::size_t p);     (2)
constexpr Vector operator<<(std::size_t p) const; (3)
constexpr Vector operator>>(std::size_t p) const; (4)
1 Left-shift this bit-vector p places (zeros are shifted in).
2 Right-shift this bit-vector p places (zeros are shifted in).
3 Returns a bit-vector that is this one left shifted by p places
4 Returns a bit-vector that is this one right shifted by p places

The first two methods are destructive (i.e. operate in-place) and return a reference to *this so can be chained with other calls.

Example
#include <GF2/GF2.h>
int main()
{
    GF2::Vector<> v("111111111111");

    std::cout << "Left shift (vectors printed here in bit-order!):\n";   (1)
    std::cout << "v:        " << v.to_bit_order() << '\n';
    std::cout << "v << 1:   " << (v << 1).to_bit_order() << '\n';
    std::cout << "v << 4:   " << (v << 4).to_bit_order() << '\n';
    std::cout << "v << 9:   " << (v << 9).to_bit_order() << '\n';
    std::cout << "v << 13:  " << (v << 13).to_bit_order() << '\n';
    std::cout << std::endl;

    std::cout << "Right shift (vectors printed here in bit-order!):\n";
    std::cout << "v:        " << v.to_bit_order() << '\n';
    std::cout << "v >> 1:   " << (v >> 1).to_bit_order() << '\n';
    std::cout << "v >> 4:   " << (v >> 4).to_bit_order() << '\n';
    std::cout << "v >> 9:   " << (v >> 9).to_bit_order() << '\n';
    std::cout << "v >> 13:  " << (v >> 13).to_bit_order() << '\n';
    std::cout << std::endl;
}
1 It is more intuitive to see the effect of left & right shifts if the vectors are printed in bit-order where the the least significant bit v[0] is on the right.
Output
Left shift (vectors printed here in bit-order!):
v:        111111111111
v << 1:   111111111110
v << 4:   111111110000
v << 9:   111000000000
v << 13:  000000000000

Right shift (vectors printed here in bit-order!):
v:        111111111111
v >> 1:   011111111111
v >> 4:   000011111111
v >> 9:   000000000111
v >> 13:  000000000000