bitset declaration in class

Hi,
i've got some problems with the declaration of a bitset container in my class

i've got a class A and want to have a bitset container in it, whose size just get's defined when running an instance of this class:

1
2
3
4
5
6
7
8
9
10
#include <bitset>

class A
{
bitset <n> bc;

A(int n) : n(n) {};

};


something like that. i hope somebody know how o solve this problem
The size of a std::bitset<> is a non-type template parameter; it must be a constant known at compile-time.

std::vector<bool> ia a standard library alternative.

boost::dynamic_bitset<> is like a std::bitset<> with a size specified at run-time.
http://www.boost.org/doc/libs/1_55_0/libs/dynamic_bitset/dynamic_bitset.html
Topic archived. No new replies allowed.