Re: static_ptr - making the factory pattern less costly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/06/2016, Radoslaw Zarzynski wrote:
[snip]
> The owning semantic has been taken from std::unique_ptr.
[snip]

Since moving or copying the static_ptr is the same as moving or
copying the stored object, I think that should be the guideline.
>
The least surprising way to implement things would be:

(1) static_ptr<T> is copyable if T is copyable. It is movable if T is
    movable. It is nothrow-copyable if T is nothrow-copyable. It is
    nothrow-movable if T is nothrow-movable.

(2) If S is derived from T, but T is copyable and S is not, attempts
    to store S in static_ptr<T> should fail. Same for move. If T is
    nothrow-copyable or nothrow-movable and S is not, storing S in T
    should fail.

That way code written using static_ptr<T> won't have its expectations
or exception safety change out from under it.

-- 
Senior Software Engineer           Red Hat Storage, Ann Arbor, MI, US
IRC: Aemerson@{RedHat, OFTC, Freenode}
0x80F7544B90EDBFB9 E707 86BA 0C1B 62CC 152C  7C12 80F7 544B 90ED BFB9
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux