MT#62181 AmArg: switch to default ctors

We are now ready to use the default constructors and assignment
operators. Add move semantics as well.

Change-Id: I89738bff6498979ff9df6bfe1f9489568c4564cf
master
Richard Fuchs 1 month ago
parent 900875bd91
commit 82d9cd7583

@ -46,15 +46,6 @@ const char* AmArg::t2str(int type) {
}
}
AmArg::AmArg(const AmArg& v)
: type(v.type) {
switch (type) {
default:
value = v.value;
break;
}
}
AmArg::AmArg(std::map<std::string, std::string>& v)
: type(Undef) {
assertStruct();
@ -240,17 +231,6 @@ const AmArg& AmArg::get(size_t idx) const {
return std::get<ValueArray>(value)[idx];
}
AmArg& AmArg::operator=(const AmArg& v) {
invalidate();
type = v.type;
switch (type) {
default:
value = v.value;
break;
}
return *this;
}
AmArg& AmArg::operator[](size_t idx) {
assertArray(idx+1);
return std::get<ValueArray>(value)[idx];

@ -128,7 +128,8 @@ class AmArg
: type(Undef)
{ }
AmArg(const AmArg& v);
AmArg(const AmArg& v) = default;
AmArg(AmArg&& v) = default;
AmArg(const int& v)
: type(Int),
@ -197,7 +198,8 @@ class AmArg
short getType() const { return type; }
AmArg& operator=(const AmArg& rhs);
AmArg& operator=(const AmArg& rhs) = default;
AmArg& operator=(AmArg&& rhs) = default;
#define isArgUndef(a) (AmArg::Undef == a.getType())
#define isArgArray(a) (AmArg::Array == a.getType())

Loading…
Cancel
Save