Boost logo

Boost Users :

Subject: Re: [Boost-users] [shared_ptr] boost::shared_ptr deleter question
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2015-08-14 09:46:12


Tamas,

I find it very surprising that your breakpoint in the destructor is not
being hit at all. This:
    #include <boost/smart_ptr/shared_ptr.hpp>
    #include <iostream>
    struct D {
        ~D() {
            std::cout << "~D\n";
        }
        template<class U>
        void operator()(U*) {
            std::cout << "operator()\n";
        }
    };
    struct T { };
    int main()
    {
        {
            auto p = boost::shared_ptr<T>(new T, D{});
            std::cout << "...\n";
        }
    }

Outputs:
    ~D
    ~D
    ...
    operator()
    ~D

Glen

--
View this message in context: http://boost.2283326.n4.nabble.com/shared-ptr-boost-shared-ptr-deleter-question-tp4678852p4678857.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net