I have a set of bitsets pointers in an unordered_map
static unordered_map< size_t, bitset<BITSIZE>* > systemBits;
And my function
template<typename system>
static bitset<BITSIZE> & getBitFor() {
size_t hash = typeid(system).hash_code();
bitset<BITSIZE> * bit = systemBits[hash];
if(bit == NULL) {
bit = new bitset<BITSIZE>(0);
(*bit) << POS++; // tried *bit << POS++ as well;
systemBits[hash] = bit;
}
return *bit;
}
Whereas POS is an int set to 1 at first.
All that I'm trying to do is shift the bitset with the amounts of position per new bitset.
(*bit) << POS++;
However this doesn't seem to work. When I cout the returned bitset all its bits are set to 0. If I do to the following:
bit->flip();
or (*bit).flip();
The bitset returned does flip all the 0 to 1.
What gives? Why does the shift operator have no effect at all?