I am trying to roll my own arbitrary size unsigned integer class, but I am having trouble finding a way to convert the std::vector<bool>
I am using to store the bits into a base 10 string. Currently, my algorithm is
unsigned long long sum = 0LL;
for(unsigned long long i=0; i<64LL && i<bit_list.size(); i++){
if(bit_list[i]){
sum |= 1LL << i;
}
}
return std::to_string(sum);
However, this only works for numbers below 2^64, because of the limitations of std::to_string
and the built in unsigned long long
. How would I go about converting, a many bit unsigned int to a string representation of the base 10 conversion? Preferably, I would like the algorithm to be extendable to any number of bits.