Bitset initialisation error

Hi everyone, I'm having trouble compiling a sieve of eratosthenes function. I'm using a bitset. The algorithm should work, but the problem lies in the variable bitset size.

Code:

`vector<int> Erat(int n)`

{

bitset<n> sieve;

...

}

This won't compile. If I change the bitset<n> to e.g. bitset<100>, it all compiles well. I've tried const int n, unsigned int n, but nothing works.

Can this problem be solved, or should I use another way of initialising the sieve? (for instance vector<bool>, or memset).

What's the fastest way in general to implement a sieve of eratosthenes? (not algorithm wise, but which container and operations to use, etc.)

Thanks in advance!