int main()
{
    {
    const boost::unique_ptr<B[]> s(new B);
    A* p = s.get();
    boost::unique_ptr<A[]> s2;
    s2 = s;
    assert(s2.get() == p);
    assert(s.get() == 0);
    assert(A::count == 1);
    assert(B::count == 1);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}
Ejemplo n.º 2
0
int main()
{
    {
        const boost::unique_ptr<B[], Deleter<B> > s(new B);
        A* p = s.get();
        boost::unique_ptr<A[], Deleter<A> > s2;
        s2 = s;
        assert(s2.get() == p);
        assert(s.get() == 0);
        assert(A::count == 1);
        assert(B::count == 1);
        assert(s2.get_deleter().state() == 5);
        assert(s.get_deleter().state() == 0);
    }
    assert(A::count == 0);
    assert(B::count == 0);
}