The problem with the above code on this line in particular:
set = std::bitset<128>(set.to_ulong() + 1ULL);
Unsigned long [ulong] is at least a 32-bit type in C ++, depending on the OS + chipset, therefore, trying to drop a 128-bit variable into this type, you created a small problem (without implementing a larger type, that is).
All is not lost. As @Oli Charlesworth mentioned above, you can use the bigint library, and they are numerous. Decent, which I used earlier, here .
For what you are trying to do above, you can try to pick the to_ulong () function in the context of a large integer library, something like to_bigint (), which works with bitrate.
Hope this helps.
source share