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:

committed by
Commit Bot

parent
467057ec7f
commit
57ff2734df
@ -281,12 +281,6 @@ class Optional final {
|
|||||||
: default_val;
|
: 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,
|
// Equality tests. Two Optionals are equal if they contain equivalent values,
|
||||||
// or if they're both empty.
|
// or if they're both empty.
|
||||||
friend bool operator==(const Optional& m1, const Optional& m2) {
|
friend bool operator==(const Optional& m1, const Optional& m2) {
|
||||||
|
@ -861,7 +861,7 @@ TEST(OptionalTest, TestMoveValue) {
|
|||||||
{
|
{
|
||||||
Optional<Logger> x(Logger(42));
|
Optional<Logger> x(Logger(42));
|
||||||
log->push_back("---");
|
log->push_back("---");
|
||||||
Logger moved = x.MoveValue();
|
Logger moved = std::move(x.value());
|
||||||
log->push_back("---");
|
log->push_back("---");
|
||||||
}
|
}
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
|
@ -330,7 +330,7 @@ RtpCodecCapability ToRtpCodecCapability(const C& cricket_codec) {
|
|||||||
cricket_codec.feedback_params.params()) {
|
cricket_codec.feedback_params.params()) {
|
||||||
rtc::Optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
|
rtc::Optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
|
||||||
if (feedback) {
|
if (feedback) {
|
||||||
codec.rtcp_feedback.push_back(feedback.MoveValue());
|
codec.rtcp_feedback.push_back(feedback.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToRtpCodecCapabilityTypeSpecific(cricket_codec, &codec);
|
ToRtpCodecCapabilityTypeSpecific(cricket_codec, &codec);
|
||||||
@ -370,7 +370,7 @@ RtpCodecParameters ToRtpCodecParameters(const C& cricket_codec) {
|
|||||||
cricket_codec.feedback_params.params()) {
|
cricket_codec.feedback_params.params()) {
|
||||||
rtc::Optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
|
rtc::Optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
|
||||||
if (feedback) {
|
if (feedback) {
|
||||||
codec_param.rtcp_feedback.push_back(feedback.MoveValue());
|
codec_param.rtcp_feedback.push_back(feedback.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToRtpCodecParametersTypeSpecific(cricket_codec, &codec_param);
|
ToRtpCodecParametersTypeSpecific(cricket_codec, &codec_param);
|
||||||
|
Reference in New Issue
Block a user