Boost logo

Boost :

Subject: Re: [boost] [Root Pointer] Benchmark
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2016-03-15 20:33:38


On Tue, Mar 15, 2016 at 7:02 PM, Phil Bouchard wrote:
> Ok I fixed it and the code will look like the following:
>

One more thing: I suspect the following will not work, with a glance
at your code: Change 'U' into:

    struct W {
        explicit W(int) { }
        W(const W&) = delete;
        W(W&&) { }
        W& operator=(const W&) = delete;
        W& operator=(W&&) = delete;
    };
    struct U {
        U(W&&) { }
    };

Now with shared_ptr and allocate_shared, this will compile just fine:

    p1 = allocate_shared<U>(Allocator<U>(n1, m2), W(1));

With root_ptr, I'm guessing you would change it to something like:

    allocator_type a1(n1, m1);
    p1 = new (a1) node(a1, W(1));

Your implementation looks like it will try to copy W which would fail
to compile.

Glen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk