Enforcing move semantics on all AST elements explicitly.

This commit is contained in:
Patrick Lühne 2017-04-11 15:55:31 +02:00
parent 6e7abb283e
commit d999415c3d
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 96 additions and 1 deletions

View File

@ -35,6 +35,11 @@ struct BinaryOperation
Modulo
};
BinaryOperation(const BinaryOperation &other) = delete;
BinaryOperation &operator=(const BinaryOperation &other) = delete;
BinaryOperation(BinaryOperation &&other) noexcept = default;
BinaryOperation &operator=(BinaryOperation &&other) noexcept = default;
BinaryOperation(Operator operator_, Term &&left, Term &&right)
: operator_{operator_},
left{std::move(left)},
@ -56,6 +61,11 @@ struct Boolean
{
}
Boolean(const Boolean &other) = delete;
Boolean &operator=(const Boolean &other) = delete;
Boolean(Boolean &&other) noexcept = default;
Boolean &operator=(Boolean &&other) noexcept = default;
bool value = false;
};
@ -80,6 +90,11 @@ struct Comparison
{
}
Comparison(const Comparison &other) = delete;
Comparison &operator=(const Comparison &other) = delete;
Comparison(Comparison &&other) noexcept = default;
Comparison &operator=(Comparison &&other) noexcept = default;
Operator operator_;
Term left;
Term right;
@ -94,6 +109,11 @@ struct Constant
{
}
Constant(const Constant &other) = delete;
Constant &operator=(const Constant &other) = delete;
Constant(Constant &&other) noexcept = default;
Constant &operator=(Constant &&other) noexcept = default;
std::string name;
};
@ -112,6 +132,11 @@ struct Function
{
}
Function(const Function &other) = delete;
Function &operator=(const Function &other) = delete;
Function(Function &&other) noexcept = default;
Function &operator=(Function &&other) noexcept = default;
std::string name;
std::vector<Term> arguments;
};
@ -129,6 +154,11 @@ struct In
assert(isPrimitive(element));
}
In(const In &other) = delete;
In &operator=(const In &other) = delete;
In(In &&other) noexcept = default;
In &operator=(In &&other) noexcept = default;
Term element;
Term set;
};
@ -142,6 +172,11 @@ struct Integer
{
}
Integer(const Integer &other) = delete;
Integer &operator=(const Integer &other) = delete;
Integer(Integer &&other) noexcept = default;
Integer &operator=(Integer &&other) noexcept = default;
int value;
};
@ -155,6 +190,11 @@ struct Interval
{
}
Interval(const Interval &other) = delete;
Interval &operator=(const Interval &other) = delete;
Interval(Interval &&other) noexcept = default;
Interval &operator=(Interval &&other) noexcept = default;
Term from;
Term to;
};
@ -174,6 +214,11 @@ struct Predicate
{
}
Predicate(const Predicate &other) = delete;
Predicate &operator=(const Predicate &other) = delete;
Predicate(Predicate &&other) noexcept = default;
Predicate &operator=(Predicate &&other) noexcept = default;
std::size_t arity() const
{
return arguments.size();
@ -198,6 +243,11 @@ struct SpecialInteger
{
}
SpecialInteger(const SpecialInteger &other) = delete;
SpecialInteger &operator=(const SpecialInteger &other) = delete;
SpecialInteger(SpecialInteger &&other) noexcept = default;
SpecialInteger &operator=(SpecialInteger &&other) noexcept = default;
Type type;
};
@ -210,6 +260,11 @@ struct String
{
}
String(const String &other) = delete;
String &operator=(const String &other) = delete;
String(String &&other) noexcept = default;
String &operator=(String &&other) noexcept = default;
std::string text;
};
@ -229,6 +284,11 @@ struct Variable
{
}
Variable(const Variable &other) = delete;
Variable &operator=(const Variable &other) = delete;
Variable(Variable &&other) noexcept = default;
Variable &operator=(Variable &&other) noexcept = default;
std::string name;
Type type;
};
@ -246,6 +306,11 @@ struct And
{
}
And(const And &other) = delete;
And &operator=(const And &other) = delete;
And(And &&other) noexcept = default;
And &operator=(And &&other) noexcept = default;
std::vector<Formula> arguments;
};
@ -259,6 +324,11 @@ struct Biconditional
{
}
Biconditional(const Biconditional &other) = delete;
Biconditional &operator=(const Biconditional &other) = delete;
Biconditional(Biconditional &&other) noexcept = default;
Biconditional &operator=(Biconditional &&other) noexcept = default;
Formula left;
Formula right;
};
@ -273,6 +343,11 @@ struct Exists
{
}
Exists(const Exists &other) = delete;
Exists &operator=(const Exists &other) = delete;
Exists(Exists &&other) noexcept = default;
Exists &operator=(Exists &&other) noexcept = default;
std::vector<Variable> variables;
Formula argument;
};
@ -287,6 +362,11 @@ struct ForAll
{
}
ForAll(const ForAll &other) = delete;
ForAll &operator=(const ForAll &other) = delete;
ForAll(ForAll &&other) noexcept = default;
ForAll &operator=(ForAll &&other) noexcept = default;
std::vector<Variable> variables;
Formula argument;
};
@ -301,6 +381,11 @@ struct Implies
{
}
Implies(const Implies &other) = delete;
Implies &operator=(const Implies &other) = delete;
Implies(Implies &&other) noexcept = default;
Implies &operator=(Implies &&other) noexcept = default;
Formula antecedent;
Formula consequent;
};
@ -314,6 +399,11 @@ struct Not
{
}
Not(const Not &other) = delete;
Not &operator=(const Not &other) = delete;
Not(Not &&other) noexcept = default;
Not &operator=(Not &&other) noexcept = default;
Formula argument;
};
@ -328,6 +418,11 @@ struct Or
{
}
Or(const Or &other) = delete;
Or &operator=(const Or &other) = delete;
Or(Or &&other) noexcept = default;
Or &operator=(Or &&other) noexcept = default;
std::vector<Formula> arguments;
};

@ -1 +1 @@
Subproject commit a49d599c0edd11bf57b41d16585cc698e188aecc
Subproject commit 207bc0a6d3e0e7d2704744718adb460daa94c732