Variables#
#include <heyoka/variable.hpp>
The variable
class#
-
class variable#
This class is used to represent symbolic variables in heyoka’s expression system.
Variables are uniquely identified by their name.
Note
Variable names beginning with a double underscore (
__
) are reserved for internal use.-
variable() noexcept#
Default constructor.
The default constructor initialises a variable with an empty name.
-
explicit variable(std::string name)#
Constructor from name.
- Parameters:
name – the name of the variable.
- Exception:
any exception thrown by the copy constructor of
std::string
.
-
variable(const variable&)#
-
variable(variable&&) noexcept#
-
variable &operator=(const variable&)#
-
variable &operator=(variable&&) noexcept#
-
~variable()#
Variables are copy/move constructible, copy/move assignable and destructible.
- Exception:
any exception thrown by the copy constructor/copy assignment operator of
std::string
.
-
[[nodiscard]] const std::string &name() const noexcept#
Name getter.
- Returns:
a reference to the name of the variable.
-
variable() noexcept#
Functions#
Operators#
-
bool operator==(const variable &a, const variable &b) noexcept#
-
bool operator!=(const variable &a, const variable &b) noexcept#
Equality comparison operators.
Two variables are considered equal if they have the same name.
- Parameters:
a – the first variable.
b – the second variable.
- Returns:
the result of the comparison.
Standard library specialisations#
-
template<>
struct std::hash<heyoka::variable># Specialisation of
std::hash
forheyoka::variable
.-
std::size_t operator()(const heyoka::variable &v) const noexcept#
- Parameters:
v – the input
heyoka::variable
.- Returns:
a hash value for v.
-
std::size_t operator()(const heyoka::variable &v) const noexcept#