View Poll Results: Do you use Boost libraries?

Voters
20. You may not vote on this poll
  • Yes, I use Boost libraries for Qt applications.

    3 15.00%
  • Yes, I do, but only for non-Qt applications.

    3 15.00%
  • No, I don't use them at all.

    14 70.00%
Results 1 to 20 of 27

Thread: Boost libraries

Hybrid View

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

    Default Re: Boost libraries

    Quote Originally Posted by wysota View Post
    I don't think I have to link to a bloated library just for this small snippet.
    std::auto_ptr from STL is the one that "hijacks" pointers, not the classes from Boost's Smart Pointers family.

  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: Boost libraries

    So Boost pointers won't do that for you:
    . I have 'played' with it in the past and used mainly the smart pointers as I often forget to delete pointers and using these, it does it for you.
    Right?

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

    Default Re: Boost libraries

    Quote Originally Posted by wysota View Post
    So Boost pointers won't do that for you: [...] Right?
    It depends which one you choose.

  4. #4
    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: Boost libraries

    So is there a pointer in the family that deletes objects pointed to when it's deleted but doesn't hijack the object (for me this is contradictory, but maybe I just can't imagine the situation)?

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

    Default Re: Boost libraries

    Quote Originally Posted by wysota View Post
    So is there a pointer in the family that deletes objects pointed to when it's deleted but doesn't hijack the object (for me this is contradictory, but maybe I just can't imagine the situation)?
    Boost has three kinds of smart pointers:
    • shared pointers, which share the ownership amongs them,
    • scoped pointers, which take the ownership for themselves,
    • weak pointers, which don't take the ownership, but know when the object was destroyed.

    All these three kinds of smart pointers are well behaved and the term "hijacking" isn't appropriate. It's just as if you said that QCoreApplication::postEvent() "hijacks" pointers, because it takes their ownership --- it doesn't, it's just a part of its contract.

    If you want to call something "pointer hijacking", take a look what std::auto_ptrs do on copy --- they're like hungry hienas, which steal a dead antilope from each other.

  6. #6
    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: Boost libraries

    So "weak pointer" is an equivalent of QPointer, "scoped pointer" does to pointers more or less what QMutexLocker does to mutexes and shared pointer is a combination of the two that does reference counting. Correct? Of course all these might fail if you use any regular pointers with the same object.

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

    Default Re: Boost libraries

    Quote Originally Posted by wysota View Post
    Correct?
    Yes.

    Quote Originally Posted by wysota View Post
    Of course all these might fail if you use any regular pointers with the same object.
    Like everything which deals with pointers.

  8. #8
    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: Boost libraries

    Quote Originally Posted by jacek View Post
    Like everything which deals with pointers.
    But not QPointer

  9. #9
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    9
    Thanked 29 Times in 29 Posts

    Default Re: Boost libraries

    Quote Originally Posted by wysota View Post
    But not QPointer
    It's nothing to boast about if your smart pointer is restricted to QObject descendants.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  10. #10
    Join Date
    Jan 2006
    Location
    Frankfurt, Germany
    Posts
    34
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    3
    Thanked 2 Times in 2 Posts

    Default Re: Boost libraries

    What I've tried from boost yet was just great. If you need to do parsing: Have a look at Boost.Spirit. It uses TMP (template meta programming) and gives C++ a completely new dimension

Similar Threads

  1. Combining Qt with other libraries (Boost, ...)
    By Raistlin in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2007, 06:28
  2. how to add new libraries to QT
    By whoops.slo in forum Newbie
    Replies: 3
    Last Post: 12th January 2007, 11:15
  3. Qt 3.3 libraries
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st December 2006, 17:25
  4. Standardization on libraries
    By brcain in forum General Discussion
    Replies: 13
    Last Post: 16th August 2006, 22:56
  5. Replies: 4
    Last Post: 7th March 2006, 08:52

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.