Results 1 to 6 of 6

Thread: Delete auto pointer from QMultiMap

  1. #1
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Delete auto pointer from QMultiMap

    HI all
    My problem is that in side QMultiMAp i ve passed auto ionter like below.

    QMultiMap<qint32, IAutoPtr>::iterator iter = NULL;

    while im trying to delete the IAutoPtr like

    delete iter.value(); its showing error "argument given to `delete', expected pointer"

    IautoPtr is an auto pointer.

    Can any body help me?

    Thank you all.
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Delete auto pointer from QMultiMap

    Which auto pointer class do you use? Is it std::auto_ptr?

  3. #3
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Delete auto pointer from QMultiMap

    Quote Originally Posted by jacek View Post
    Which auto pointer class do you use? Is it std::auto_ptr?
    ya its std::auto_ptr
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Delete auto pointer from QMultiMap

    Quote Originally Posted by phillip_Qt View Post
    ya its std::auto_ptr
    auto_ptr inside container classes:
    Never ever use a container of auto_ptr objects. The standard says that "undefined" behavior is the result, but it is guaranteed to be messy.
    J-P Nurmi

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

    Default Re: Delete auto pointer from QMultiMap

    What is the reason of using an auto pointer in the map?

  6. #6
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Delete auto pointer from QMultiMap


Similar Threads

  1. c++, placement delete upon exception
    By stinos in forum General Programming
    Replies: 6
    Last Post: 31st October 2006, 16:38

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.