Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Issue 1432193002: Add std::unique_ptr conversions to scoped_ptr. (Closed)

Created:
5 years, 1 month ago by dcheng
Modified:
4 years, 8 months ago
Reviewers:
danakj, Nico
CC:
chromium-reviews, gavinp+memory_chromium.org, jamesr, Jeffrey Yasskin, Ryan Sleevi, tracing+reviews_chromium.org, vmpstr+watch_chromium.org, wfh+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add std::unique_ptr conversions to scoped_ptr. This is intended to allow code to gracefully move from scoped_ptr to std::unique_ptr. Since converting from one smart pointer to another is a destructive operation, the conversions are only permitted on rvalues. Using it is simple: scoped_ptr<int> s(new int(8)); std::unique_ptr<int> u(std::move(s)); // Now u owns the int. s = std::move(u); // And now s owns the int again. BUG=554298

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : I wish my local build wasn't randomly broken #

Total comments: 8

Patch Set 4 : Bad rebase #

Patch Set 5 : Fixed rebase #

Patch Set 6 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -0 lines) Patch
M base/memory/scoped_ptr.h View 1 2 3 4 5 3 chunks +35 lines, -0 lines 0 comments Download
M base/memory/scoped_ptr_unittest.cc View 1 2 3 4 5 2 chunks +81 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
dcheng
Proof of concept. Note that finishing this CL would require fixing a couple more references ...
5 years, 1 month ago (2015-11-11 16:18:34 UTC) #3
danakj
https://codereview.chromium.org/1432193002/diff/40001/base/memory/scoped_ptr.h File base/memory/scoped_ptr.h (right): https://codereview.chromium.org/1432193002/diff/40001/base/memory/scoped_ptr.h#newcode390 base/memory/scoped_ptr.h:390: operator std::unique_ptr<U, V>() && { Vlad pointed out that ...
5 years, 1 month ago (2015-11-14 01:29:31 UTC) #4
danakj
5 years, 1 month ago (2015-11-14 01:29:44 UTC) #5
danakj
https://codereview.chromium.org/1432193002/diff/40001/base/memory/scoped_ptr.h File base/memory/scoped_ptr.h (right): https://codereview.chromium.org/1432193002/diff/40001/base/memory/scoped_ptr.h#newcode508 base/memory/scoped_ptr.h:508: operator std::unique_ptr<T[], D>() && { On 2015/11/14 01:29:31, danakj ...
5 years, 1 month ago (2015-11-14 01:30:07 UTC) #6
dcheng
https://codereview.chromium.org/1432193002/diff/40001/base/memory/scoped_ptr.h File base/memory/scoped_ptr.h (right): https://codereview.chromium.org/1432193002/diff/40001/base/memory/scoped_ptr.h#newcode390 base/memory/scoped_ptr.h:390: operator std::unique_ptr<U, V>() && { On 2015/11/14 at 01:29:31, ...
5 years, 1 month ago (2015-11-14 01:37:10 UTC) #7
dcheng
5 years ago (2015-12-09 00:31:12 UTC) #8
I'm going to go ahead and close this. This doesn't seem useful without VS2015,
and I suspect that we'll be able to make scoped_ptr a typedef before VS2015.

Probably.

Powered by Google App Engine
This is Rietveld 408576698