Results 1 to 4 of 4

Thread: QVector<QVector3D> index out of range at pushback operation

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2018
    Posts
    34
    Thanks
    18
    Qt products
    Qt5
    Platforms
    Windows

    Default QVector<QVector3D> index out of range at pushback operation

    I have this typeof data:
    Qt Code:
    1. QVector<QVector3D> vector_aux;
    2. QVector<int> indicies;
    3. QVector<QVector3D> vector_coord;
    To copy to clipboard, switch view to plain text mode 

    My goal is to rearrange the vector_aux to vector_coord by the value stored in indicies.

    If i store my singular data in vector_aux like this no error occured:
    Qt Code:
    1. vector_aux << QVector3D( 0.276388, 0.850649, -0.447220)
    2. << QVector3D( 0.483971, 0.716565, -0.502302) .. and so on till i store 104 data.
    To copy to clipboard, switch view to plain text mode 

    The indicies.lenght() => 548

    If i try do it and when i stored 500 data the program crash:
    ..
    Ok at = 490
    Ok at = 500
    ASSERT failure in QVector<T>:: operator[]: "index out of range", file C:\Qt\Qt5.13.1\5.13.1\mingw73_64\include/QtCore/qvector.h, line 448

    Qt Code:
    1. for (int i=0; i<indicies.length(); i++){
    2. vector_coord.push_back(vector_aux[indicies[i]]);
    3. if (i%10==0){
    4. qDebug() << "Ok at =" << i;
    5. }
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

    There is a limit of 500 data that i can store, or there an other reason for my trouble?
    Last edited by andreaQt; 4th September 2020 at 17:56.

Similar Threads

  1. Replies: 5
    Last Post: 13th May 2015, 17:18
  2. Replies: 0
    Last Post: 9th January 2015, 11:09
  3. What's the fastest QVector operation
    By Momergil in forum Qt Programming
    Replies: 5
    Last Post: 30th May 2014, 17:22
  4. best way to delete QVector<QVector3D>
    By saman_artorious in forum Qt Programming
    Replies: 11
    Last Post: 4th July 2013, 09:11
  5. Replies: 0
    Last Post: 22nd June 2013, 11:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.