This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: Problem using bitset bit access
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: Re: Problem using bitset bit access
- From: Meenaradchagan Vishnu <mvishnu at fore dot com>
- Date: Mon, 4 Oct 1999 13:39:47 -0400 (EDT)
- Reply-To: Meenaradchagan Vishnu <mvishnu at fore dot com>
Here is a simple testcase that fails to compile:
#include <hash_map> // if I don't include this, I get "`CHAR_BIT' was not
//declared in this scope" error several times.
#include <iostream>
#include <bitset>
int main()
{
bitset<191> b;
b[ 1 ] = 5;
cout << b[ 1 ] << endl;
}
This gives the following compile error messages:
[leapfrog:~] g++ -c test_bitset.cc
/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.1/../../../../include/g++-3/b
itset: In method `bitset<191,long unsigned
int>::reference::reference(bitset<191,long unsigned int> &, unsigned int)':
/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.1/../../../../include/g++-3/b
itset:751: instantiated from `bitset<191,long unsigned int>::operator
[](unsigned int)'
test_bitset.cc:10: instantiated from here
/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.1/../../../../include/g++-3/b
itset:91: `long unsigned int & _Base_bitset<6,long unsigned
int>::_M_getword(unsigned int)' is inaccessible
/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.1/../../../../include/g++-3/b
itset:581: within this context
[leapfrog:~]
(Note: I temporarily "fixed" the problem by changing line 533 of
/usr/local/include/g++-3/bitset to
template<size_t _Nb, class _WordT = unsigned long>
class bitset : public _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>
(i.e., from private inheritance to public inheritance.)