I\'m working on a structure that uses std::bitset and it looks like this:
Register.h
#pragma once
#include
#include <
I don't know of a single algorithm that does this but you can use a combination of bitset::to_string
and std::reverse
to do this.
A minimal example.
#include "Register.h"
#include <algorithm>
#include <bitset>
#include <iostream>
#include <string>
int main() {
vpc::Byte register_ = 169;
std::cout << register_ << std::endl;
auto str = register_.to_string();
std::reverse(str.begin(), str.end());
auto x = vpc::Byte(str);
std::cout << x << std::endl;
return 0;
}
See Demo Here.
Output:
10101001
10010101
This method can be used with any of the other bitset
types you have defined.