This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Inconsistent definition of vector<bool> specialization (again)
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Subject: Re: Inconsistent definition of vector<bool> specialization (again)
- From: Arvid Bessen <a_bessen at informatik dot uni-kl dot de>
- Date: Sat, 10 Mar 2001 15:28:30 +0100
- CC: libstdc++ at sourceware dot cygnus dot com
- References: <Pine.SOL.3.91.1010309163403.5417A-100000@cse.cygnus.com>
Benjamin Kosnik wrote:
>
> can you please just post the code that is not working for you and the
> error you receive? I'm a bit confused as to what your problem is.
>
> -benjamin
Okay, a little example:
// ---------------------------- two.hh ----------------------------
#include <vector.h>
class Example {
public:
vector<bool> vb;
Example();
};
// ---------------------------- two.cc ----------------------------
#include "two.hh"
Example::Example()
: vb()
{
// 'print vb' in gdb returns:
// $1 = {<_Vector_base<bool,allocator<bool> >> =
// {<_Vector_alloc_base<bool,allocator<bool>,>> = {_M_start
// = 0x0, _M_finish = 0x0,
// _M_end_of_storage = 0x0}, <No data fields>}, <No data
// fields>}
}
// ---------------------------- one.cc ----------------------------
#include <vector>
#include "two.hh"
int main(int argc, char * argv[]) {
Example ex;
// 'print ex.vb' in gdb now returns:
// $2 = {<_Bvector_base<allocator<bool> >> =
// {<_Bvector_alloc_base<allocator<bool>,>> = {_M_start =
// {<random_access_iterator<bool,int>> = {<No data fields>},
// _M_p = 0x0, _M_offset = 0},
// _M_finish = {<random_access_iterator<bool,int>> = {<No
// data fields>},
// _M_p = 0x401a1044, _M_offset = 1073792864},
// _M_end_of_storage = 0xbffffaf0}, <No data fields>}, <No
// data fields>}
//
// and this prints 1087457664
cout << ex.vb.size() << endl;
}
// ----------------------------------------------------------------
When I compile two.cc, I don't use the specialization from
<stl_bvector.h> because I included <vector.h>.
In one.cc I included <vector> and the vector<bool> is treated as if it
were the specialized version.
Arvid