So basically I want to store std::bitset<128>
within std::vector<>
.
I have tried this:
std::vector<std::bitset<128>> myVector;
But compiler complains about invalid template parameters. How can I fix this and can I add this type into a typedef
for later use?
EDIT: Indeed my compiler seems to use C++03
as its default standard and I had to use vector<bitset<128> >
for this to work with current settings.
Yes it works, even with a typedef
.
But note that you need c++11 (-std=c++11) to use two right adjacent angle brackets in your declaration.
#include <vector>
#include <bitset>
int main() {
typedef std::vector<std::bitset<128>> Bitset_vec;
Bitset_vec v;
return 0;
}
If you don't have support for c++11, add a space between the brackets :
typedef std::vector<std::bitset<128> > Bitset_vec;
Live example here (note the -std=c++11 option)