Re: queue_transaction interface + unique_ptr + performance

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

 



On 03/12/2015, Somnath Roy wrote:
> I don't think make_shared / make_unique is part of c++11 (and ceph is using that). It is part of c++14 I guess..

std::make_shared is in C++11, std::make_unique is in C++14. In addition to
performance, std::make_shared is also more correct, in that:

  std::shared_ptr<T>(new T)

can leak object allocated by 'new T' if the allocation for the shared_ptr
fails.

std::make_unique is nice for cleanliness and symmetry, but doesn't add anything
for performance or safety. (Also you can write your own make_unique, where
make_shared is intimately involved with the details of shared_ptr.)

Attachment: signature.asc
Description: PGP signature


[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