D
Daniel
I am baffled. According to the C++ faq lite it is ok to use a reference
as an lvalue, and the subscript operator returns a reference. However,
when I run this program, it crashes!
I will go set up a different compiler and try again while I'm waiting
for a reply, but I'm really curious about why this is happening. I'm
using the mingw compiler that came with dev-c++ on an up to date Windows
2000 box. Any help would be greatly appreciated, thanks.
#include <vector>
int main()
{
std::vector<int> vi;
vi[0] = 1; // Crashes for no apparent reason.
//vi.push_back(1); // Unacceptable workaround, but it doesn't crash.
return(0);
}
as an lvalue, and the subscript operator returns a reference. However,
when I run this program, it crashes!
I will go set up a different compiler and try again while I'm waiting
for a reply, but I'm really curious about why this is happening. I'm
using the mingw compiler that came with dev-c++ on an up to date Windows
2000 box. Any help would be greatly appreciated, thanks.
#include <vector>
int main()
{
std::vector<int> vi;
vi[0] = 1; // Crashes for no apparent reason.
//vi.push_back(1); // Unacceptable workaround, but it doesn't crash.
return(0);
}