From faa62b0d1e5ee6343cd67c7a2f24045e727d56ff Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 18 Jul 2018 16:15:27 -0400 Subject: [PATCH] telemetry: Default copy/move constructors and assignment operators This provides the equivalent behavior, but without as much boilerplate. While we're at it, explicitly default the move constructor, since we have a move-assignment operator defined. --- src/common/telemetry.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/common/telemetry.h b/src/common/telemetry.h index 3694c76f2..f96bab4f9 100644 --- a/src/common/telemetry.h +++ b/src/common/telemetry.h @@ -58,21 +58,11 @@ public: Field(FieldType type, std::string name, T&& value) : name(std::move(name)), type(type), value(std::move(value)) {} - Field(const Field& other) : Field(other.type, other.name, other.value) {} + Field(const Field& other) = default; + Field& operator=(const Field& other) = default; - Field& operator=(const Field& other) { - type = other.type; - name = other.name; - value = other.value; - return *this; - } - - Field& operator=(Field&& other) { - type = other.type; - name = std::move(other.name); - value = std::move(other.value); - return *this; - } + Field(Field&&) = default; + Field& operator=(Field&& other) = default; void Accept(VisitorInterface& visitor) const override;