vendredi 22 janvier 2021

How do I create a vector of bitmasks that basically replaces a vector of boolean in C++11?

I am trying to create a vector of bitmasks to store true/ false values which are going to tell me if the value particular index in another vector needs to be printed or not.

eg: std::vector<int> a ; b is a vector of bitmasks which is going to hold flag values that correspond to the integer vector a and this flag tells me if that particular value at the corresponding index needs to be printed or not.

a {1,2,3}  
b { true, false ,true} // I need a similar bitmask which would help me print 1 and 3 

this task can be achieved in other ways the problem I am working in requires the use of bitmask. Thanks in advance for helping me with this.

Aucun commentaire:

Enregistrer un commentaire