http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56753
Bug #: 56753
Summary: vector.size() always returns 0
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: libstdc++
AssignedTo: [email protected]
ReportedBy: [email protected]
Test code:
/*
* File: main.cpp
* Author: rbross
*
* Created on March 27, 2013, 8:16 AM
*/
#include <cstdlib>
#include <vector>
#include <iostream>
using namespace std;
typedef vector<void *> BS_VECTOR;
/*
*
*/
int main(int argc, char** argv)
{
BS_VECTOR vBS;
vBS.reserve(100);
cout << "Size " << vBS.size() << " Capacity " << vBS.capacity() << endl;
vBS[10] = (void *) 0x4d3;
vBS[12] = (void *) 0x11d7;
cout << "Size " << vBS.size() << " Capacity " << vBS.capacity() << endl;
cout << "vBS[10] " << vBS[10] << endl;
cout << "vBS[12] " << vBS[12] << endl;
return 0;
}
Output:
Size 0 Capacity 100
Size 0 Capacity 100
vBS[10] 0x4d3
vBS[12] 0x11d7
Note that accessing the