Add defaulted move constructors for some types that just got copy constructors
They can all benefit from moving, since they contain std::string and std::vector. We intended to add these in https://codereview.webrtc.org/1896953004/, but got compiler errors we couldn't make sense of, so we skipped them. It turns out that what the compiler was complaining about was that when we said we'd have a user-defined move constructor, it stopped generating a copy assignment operator for us. This CL solves the problem by outfitting the types with defaulted copy and move assignment operators too. Review URL: https://codereview.webrtc.org/1899173002 Cr-Commit-Position: refs/heads/master@{#12469}
This commit is contained in:
parent
7bc7c06e6a
commit
4fb3d2bcca
@ -56,6 +56,7 @@ Pathname::Pathname()
|
||||
}
|
||||
|
||||
Pathname::Pathname(const Pathname&) = default;
|
||||
Pathname::Pathname(Pathname&&) = default;
|
||||
|
||||
Pathname::Pathname(const std::string& pathname)
|
||||
: folder_delimiter_(DEFAULT_FOLDER_DELIM) {
|
||||
@ -67,6 +68,9 @@ Pathname::Pathname(const std::string& folder, const std::string& filename)
|
||||
SetPathname(folder, filename);
|
||||
}
|
||||
|
||||
Pathname& Pathname::operator=(const Pathname&) = default;
|
||||
Pathname& Pathname::operator=(Pathname&&) = default;
|
||||
|
||||
void Pathname::SetFolderDelimiter(char delimiter) {
|
||||
ASSERT(IsFolderDelimiter(delimiter));
|
||||
folder_delimiter_ = delimiter;
|
||||
|
||||
@ -45,9 +45,13 @@ public:
|
||||
|
||||
Pathname();
|
||||
Pathname(const Pathname&);
|
||||
Pathname(Pathname&&);
|
||||
Pathname(const std::string& pathname);
|
||||
Pathname(const std::string& folder, const std::string& filename);
|
||||
|
||||
Pathname& operator=(const Pathname&);
|
||||
Pathname& operator=(Pathname&&);
|
||||
|
||||
// Set's the default folder delimiter for this Pathname
|
||||
char folder_delimiter() const { return folder_delimiter_; }
|
||||
void SetFolderDelimiter(char delimiter);
|
||||
|
||||
@ -16,10 +16,13 @@
|
||||
namespace webrtc {
|
||||
|
||||
AudioEncoder::EncodedInfo::EncodedInfo() = default;
|
||||
|
||||
AudioEncoder::EncodedInfo::EncodedInfo(const EncodedInfo&) = default;
|
||||
|
||||
AudioEncoder::EncodedInfo::EncodedInfo(EncodedInfo&&) = default;
|
||||
AudioEncoder::EncodedInfo::~EncodedInfo() = default;
|
||||
AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(
|
||||
const EncodedInfo&) = default;
|
||||
AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(EncodedInfo&&) =
|
||||
default;
|
||||
|
||||
int AudioEncoder::RtpTimestampRateHz() const {
|
||||
return SampleRateHz();
|
||||
|
||||
@ -46,7 +46,10 @@ class AudioEncoder {
|
||||
struct EncodedInfo : public EncodedInfoLeaf {
|
||||
EncodedInfo();
|
||||
EncodedInfo(const EncodedInfo&);
|
||||
EncodedInfo(EncodedInfo&&);
|
||||
~EncodedInfo();
|
||||
EncodedInfo& operator=(const EncodedInfo&);
|
||||
EncodedInfo& operator=(EncodedInfo&&);
|
||||
|
||||
std::vector<EncodedInfoLeaf> redundant;
|
||||
};
|
||||
|
||||
@ -21,6 +21,7 @@ DesktopRegion::RowSpan::RowSpan(int32_t left, int32_t right)
|
||||
}
|
||||
|
||||
DesktopRegion::Row::Row(const Row&) = default;
|
||||
DesktopRegion::Row::Row(Row&&) = default;
|
||||
|
||||
DesktopRegion::Row::Row(int32_t top, int32_t bottom)
|
||||
: top(top), bottom(bottom) {
|
||||
|
||||
@ -48,6 +48,7 @@ class DesktopRegion {
|
||||
// have the same vertical position.
|
||||
struct Row {
|
||||
Row(const Row&);
|
||||
Row(Row&&);
|
||||
Row(int32_t top, int32_t bottom);
|
||||
~Row();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user