Results 1 to 12 of 12

Thread: best way to delete QVector<QVector3D>

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11
    Thanks
    15
    Thanked 16 Times in 15 Posts

    Default Re: best way to delete QVector<QVector3D>

    but what if it doesn't go out of scope. I need to delete after right after drawing.

    Qt Code:
    1. qDeleteAll(vertices.begin(), vertices.end());
    To copy to clipboard, switch view to plain text mode 

    gives the following error:
    error: type 'class QVector3D' argument given to 'delete', expected pointer
    Qt Code:
    1. template <typename ForwardIterator>
    2. Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
    3. {
    4. while (begin != end) {
    5. delete *begin;
    6. ++begin;
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: best way to delete QVector<QVector3D>

    Quote Originally Posted by saman_artorious View Post
    but what if it doesn't go out of scope. I need to delete after right after drawing.
    Clear the vector.

    Qt Code:
    1. vertices.clear();
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 22nd June 2013, 10:02
  2. sort a Qvector based on another Qvector
    By OzQTNoob in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2012, 06:39
  3. Replies: 5
    Last Post: 2nd September 2011, 23:11
  4. QVector3D, real
    By zaphod77 in forum Newbie
    Replies: 7
    Last Post: 24th March 2011, 19:04
  5. Replies: 4
    Last Post: 19th February 2009, 11:10

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
  •  
Qt is a trademark of The Qt Company.