std::vector resize crash

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel J Watkins

    std::vector resize crash

    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[i].resize(i+1);
    }
    }

    Thanks in advance,

    Daniel.


  • Kai-Uwe Bux

    #2
    Re: std::vector resize crash

    Daniel J Watkins wrote:
    [color=blue]
    > 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)[/color]

    int main (void)
    [color=blue]
    > {
    > std::vector< std::vector<int > > triangle(5);
    >
    > for(int i = 0; i < triangle.size() ; i++)
    > {
    > triangle[i].resize(i+1);
    > }
    > }[/color]

    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

    Comment

    Working...