I want to store a static constant bitset of 216 bits, with a specific sequence of 1s and 0s that never changes.
I thought of using an initializer string as proposed by this post :
std::bitset<1<<16> myBitset("101100101000110 ... "); // the ellipsis are replaced by the actual 65536-character sequence
But the compiler (VS2013) gives me the "string too long" error.
UPDATE
I tried splitting the string into smaller chunks, as proposed in the post linked above, like so:
std::bitset<1<<16> myBitset("100101 ..."
"011001 ..."
...
);
But I get the error C1091: compiler limit: string exceeds 65535 bytes in length. My string is 65536 bytes (well technically 65537, with the EOS character).
What are my other options?
UPDATE
Thanks to luk32, this is the beautiful code I ended up with:
const std::bitset<1<<16> bs = (std::bitset<1<<16>("101011...")
<< 7* (1<<13)) | (std::bitset<1<<16>("110011...")
<< 6* (1<<13)) | (std::bitset<1<<16>("101111...")
<< 5* (1<<13)) | (std::bitset<1<<16>("110110...")
<< 4* (1<<13)) | (std::bitset<1<<16>("011011...")
<< 3* (1<<13)) | (std::bitset<1<<16>("111011...")
<< 2* (1<<13)) | (std::bitset<1<<16>("111001...")
<< 1* (1<<13)) | std::bitset<1<<16>("1100111...");