56 [[nodiscard]]
const std::string&
value()
const {
return value_; }
59 return kind_ == other.kind_ && value_ == other.value_;
61 [[nodiscard]]
bool operator!=(
const Term& other)
const {
return !(*
this == other); }
73 return std::hash<std::string>{}(term.
value()) ^ (
static_cast<std::size_t
>(term.
kind()) << 1);
A Datalog term: either a constant (e.g. a) or a variable (e.g. X) – never a compound/function-symbol ...
Definition datalog_term.hpp:38
bool is_variable() const
True iff this term is a variable.
Definition datalog_term.hpp:53
bool operator==(const Term &other) const
Definition datalog_term.hpp:58
const std::string & value() const
The constant's value, or the variable's name – whichever this term is.
Definition datalog_term.hpp:56
bool operator!=(const Term &other) const
Definition datalog_term.hpp:61
TermKind kind() const
Whether this term is a constant or a variable.
Definition datalog_term.hpp:47
bool is_constant() const
True iff this term is a constant.
Definition datalog_term.hpp:50
static Term make_variable(std::string name)
Constructs a variable term with the given name (e.g. "X").
Definition datalog_term.hpp:44
static Term make_constant(std::string value)
Constructs a constant term with the given value (e.g. "a").
Definition datalog_term.hpp:41
Definition datalog_atom.hpp:14
TermKind
Which of the two (and only two) term alternatives this Term is.
Definition datalog_term.hpp:15
Hash functor for Term, for use in std::unordered_map/std::unordered_set.
Definition datalog_term.hpp:71
std::size_t operator()(const Term &term) const
Definition datalog_term.hpp:72