Remove rtc::Optional::MoveValue

This function is not present in std::optional
The only use of MoveValue doesn't need move since
copying underneath struct is as correct and as fast as moving

Bug: webrtc:9078
Change-Id: Ic0c87e50ffd8f6c024759b14ceeb8922b5d3a6fd
Reviewed-on: https://webrtc-review.googlesource.com/64986
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22646}
This commit is contained in:
Danil Chapovalov
2018-03-28 11:25:15 +02:00
committed by Commit Bot
parent 467057ec7f
commit 57ff2734df
3 changed files with 3 additions and 9 deletions

View File

@ -281,12 +281,6 @@ class Optional final {
: default_val;
}
// Dereference and move value.
T MoveValue() {
RTC_DCHECK(has_value_);
return std::move(value_);
}
// Equality tests. Two Optionals are equal if they contain equivalent values,
// or if they're both empty.
friend bool operator==(const Optional& m1, const Optional& m2) {

View File

@ -861,7 +861,7 @@ TEST(OptionalTest, TestMoveValue) {
{
Optional<Logger> x(Logger(42));
log->push_back("---");
Logger moved = x.MoveValue();
Logger moved = std::move(x.value());
log->push_back("---");
}
EXPECT_EQ(

View File

@ -330,7 +330,7 @@ RtpCodecCapability ToRtpCodecCapability(const C& cricket_codec) {
cricket_codec.feedback_params.params()) {
rtc::Optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
if (feedback) {
codec.rtcp_feedback.push_back(feedback.MoveValue());
codec.rtcp_feedback.push_back(feedback.value());
}
}
ToRtpCodecCapabilityTypeSpecific(cricket_codec, &codec);
@ -370,7 +370,7 @@ RtpCodecParameters ToRtpCodecParameters(const C& cricket_codec) {
cricket_codec.feedback_params.params()) {
rtc::Optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
if (feedback) {
codec_param.rtcp_feedback.push_back(feedback.MoveValue());
codec_param.rtcp_feedback.push_back(feedback.value());
}
}
ToRtpCodecParametersTypeSpecific(cricket_codec, &codec_param);