Binary Multiplication Using A Bool Vector

Jan 19, 2016 at 7:25am
How exactly would I create a function to multiply 2 vectors of bools? If possible by overloading the *= operator. A point in the right direction would even help, thanks!

ex:
1
2
3
vector<bool> a = {1,0,1,0,0};
vector<bool> b = {1,0,1,1,1};
a*=b;


Last edited on Jan 19, 2016 at 7:25am
Jan 19, 2016 at 8:18am
You'll need to be able to add numbers first, so start by writing code to add two vectors of bool.

Can these be arbitrarily large vectors are will there be some max number of bits? If there is a max and it's small (like 64 or less) then you could convert the vector<bool> into a 64 bit integer, use integer arithmetic, and convert back.
Topic archived. No new replies allowed.