Problem using bitset bit access

Benjamin Kosnik bkoz@cygnus.com
Mon Oct 4 15:00:00 GMT 1999


Meenaradchagan,
A couple of things. 

1) this looks like a bug in the libstdc++ that was shipped w/ egcs-2.95.1
and that is not present in the current libstdc++-v3 distro. These are
separate libraries, with different sources. You may want to use the v-3
snapshots--see 
http://sourceware.cygnus.com/libstdc++

2) hash_map is an extension to the standard. You shouldn't need it to
compile, and if you do indeed use it with v-3, you'll need to do 

#include <ext/hash_map.h>

not

#include <hash_map.h>

Okay?

-Benjamin



This works for me with current v-3 sources:

#include <iostream>
#include <bitset>

int main()
  {
    bitset<191> b;

    b[1] = 1;
    b[2] = 0;

    cout << b[1] << endl; // "1"
    cout << b[2] << endl; // "0"
  }





More information about the Libstdc++ mailing list