Commit Graph

6 Commits

Author SHA1 Message Date
d040480f69 rtc::Optional<T>: Don't secretly contain a default-constructed T when empty
Instead, use a neat trick with union to ensure that we have a T only
when we're supposed to (and just a bunch of unused memory otherwise).
This is how std::optional behaves, so it makes sense for us to do the
same (and it's convenient, too, since we don't have to pay for the
default-constructed T, and we support types that don't have default
constructors).

Doing this became possible recently when we dropped support for MSVC
2013, which didn't support unions containing non-trivial types.

Review-Url: https://codereview.webrtc.org/1896833004
Cr-Commit-Position: refs/heads/master@{#12664}
2016-05-09 13:06:10 +00:00
555604a746 Replace scoped_ptr with unique_ptr in webrtc/base/
This propagated into various other places. Also had to #include headers that
were implicitly pulled by "scoped_ptr.h".

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1920043002

Cr-Commit-Position: refs/heads/master@{#12501}
2016-04-26 10:13:28 +00:00
1d50ee44fd Stop using some scoped_ptr features that unique_ptr doesn't have
No operator== that accepts one unique_ptr<T> and one T*. No implicit
conversion to bool. No rtc_make_scoped_ptr function.

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1803833002

Cr-Commit-Position: refs/heads/master@{#12048}
2016-03-18 05:54:49 +00:00
b21379515a Fix confusing naming of static class variables
As suggested here: https://codereview.webrtc.org/1803833002/#msg8

Review URL: https://codereview.webrtc.org/1807193002

Cr-Commit-Position: refs/heads/master@{#12036}
2016-03-17 15:38:16 +00:00
cea7c2f783 Replace manual casting to rvalue reference with calls to std::move
Review URL: https://codereview.webrtc.org/1570473002

Cr-Commit-Position: refs/heads/master@{#11163}
2016-01-07 13:52:09 +00:00
be57983f4b Rename Maybe to Optional
And add examples of good and bad usage to the documentation.

R=aluebs@webrtc.org, henrik.lundin@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1432553007 .

Cr-Commit-Position: refs/heads/master@{#10588}
2015-11-10 21:34:32 +00:00