[CXX-1162] Use stdx::make_unique instead of bare calls to 'new' when initializing std::unique_ptr variables, where possible Created: 12/Dec/16  Updated: 11/Aug/17  Resolved: 07/Jun/17

Status: Closed
Project: C++ Driver
Component/s: Implementation
Affects Version/s: None
Fix Version/s: 3.2.0-rc0

Type: Task Priority: Minor - P4
Reporter: Backlog - CXX Driver Team Assignee: Patrick Freed
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Using stdx::make_unique increases exception safety in some circumstances. See https://herbsutter.com/gotw/_102/ for reference.



 Comments   
Comment by Githook User [ 07/Jun/17 ]

Author:

{u'username': u'patrickfreed', u'name': u'Patrick Freed', u'email': u'fridpatrick@gmail.com'}

Message: CXX-1162 Use stdx::make_unique instead of 'new' when initializing std::unique_ptr's

This commit does not change some instances due to their need for a supplied destructor (make_unique does not allow for them).
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/c2d4905346142cde8eef9766022b0a7fe1766de4

Comment by J Rassi [ 12/Dec/16 ]

Right, thanks for the reminder. Updated summary to add "where possible".

Comment by Andrew Morrow (Inactive) [ 12/Dec/16 ]

Note that there may be cases where you can't, because the constructor of the thing you want to make_unique for is private, and them std[x]::make_unique can't call it.

Generated at Wed Feb 07 22:01:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.