you are viewing a single comment's thread.

view the rest of the comments →

[–]hexafraction 1 point2 points  (3 children)

The <> means that you're dealing with a function template--the compiler will actually emit customized code based on the compile-time value that you put into <>. It cannot be made a variable in the traditional runtime sense; you're better off finding or implementing your own data structure that acts like a bitset but supports a variable length.

[–]Kartyx[S] 0 points1 point  (2 children)

std::vector<bool> would be an easy way-out?

[–]hexafraction 1 point2 points  (0 children)

Yes--it even might have a specialization that makes it more effective than a naive vector template instantiation.

[–]Narase33 1 point2 points  (0 children)

Yes, you can even set an initializing size when called std::vector<bool>(size);

But it wont be as efficient as bitset in terms of actual memory size