bitset member in a class

Hi,

I am looking to have a member of type bitset in a C++ class. Is it possible ?
Something like below:

Class abc
{
bitset<32> var;
}

thanks
Yes.

You can do it exactly like you'd expect.
But I see compilation error :

error C2143: syntax error : missing ';' before '<'

I am compiling using "std" namespace and included bitset headerfile. I am compiling in Visual Studio 2010.
1
2
3
4
5
6
7
8
9
10
11
#include <bitset>
using namespace std;

class Foo
{
    bitset<32>  bs;
};

int main()
{
}


Compiles just fine for me.

You probably have syntax errors somewhere, which is why you're getting a syntax error ( =P ). I won't be able to tell you what you're doing wrong without seeing code.
Last edited on
Thanks.

It looks good now in my project.

Had not included namespace in my header file.

Have a good day.
Topic archived. No new replies allowed.