std::vector resize crash

D

Daniel J Watkins

Hi,

When I attempt to resize a column in a 2d vector I receive the error listed
below. I'm using the libraries supplied with VxWorks.

0xf3fe450 (tExcTask): memPartFree: invalid block 0xf340ef0 in partition
0x311b8c

Here is the example code I'm using to produce the error. Any idea's what is
wrong with the code?

#include <vector>

using namespace std;
using std::vector;

void main(void)
{
std::vector< std::vector<int> > triangle(5);

for(int i = 0; i < triangle.size(); i++)
{
triangle.resize(i+1);
}
}

Thanks in advance,

Daniel.
 
K

Kai-Uwe Bux

Daniel said:
Hi,

When I attempt to resize a column in a 2d vector I receive the error
listed
below. I'm using the libraries supplied with VxWorks.

0xf3fe450 (tExcTask): memPartFree: invalid block 0xf340ef0 in partition
0x311b8c

Here is the example code I'm using to produce the error. Any idea's what
is wrong with the code?

#include <vector>

using namespace std;
using std::vector;

void main(void)

int main (void)
{
std::vector< std::vector<int> > triangle(5);

for(int i = 0; i < triangle.size(); i++)
{
triangle.resize(i+1);
}
}


Everything else is fine.

I have no idea about this VxWorks thing. But if you think it detects an
error, maybe you are using an outdated compiler that uses a buggy
implementation of std::vector. The fact that it accepts void main ( void )
may hint in that direction, too.


Best

Kai-Uwe Bux
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top