The Symbol class

class codegenvar::Symbol

The class Symbol is the main class of the CppCondegenVar project.

Constructors

A Symbol object can be initialized as a named symbol or a constant.

Symbol x("x"), y("y"), zero(0), c3(3.0);
auto vars = Symbol::Array("a", "b", "c", 0, 3.14);
template <class… Args>
static std::array<Symbol, sizeof...(Args)> codegenvar::Symbol::Array(Args... args)

Constructor creating an array of symbols.

auto vars = Symbol::Array("a", "b", "c", 0, 3.14);

codegenvar::Symbol::Symbol(const std::string &name)

Constructor creating a named variable.

codegenvar::Symbol::Symbol(int value)

Constructors creating a constant.

codegenvar::Symbol::Symbol(long int value)

Constructors creating a constant.

codegenvar::Symbol::Symbol(long long int value)

Constructors creating a constant.

codegenvar::Symbol::Symbol(float value)

Constructors creating a constant.

codegenvar::Symbol::Symbol(double value)

Constructors creating a constant.

Mathematical operations

The codegenvar::Symbol class has support for the following mathematical operations.

Symbol codegenvar::operator+(const Symbol &lhs, const Symbol &rhs)
Symbol codegenvar::operator-(const Symbol &lhs, const Symbol &rhs)
Symbol codegenvar::operator*(const Symbol &lhs, const Symbol &rhs)
Symbol codegenvar::operator/(const Symbol &lhs, const Symbol &rhs)
Symbol codegenvar::operator-(const Symbol &value)
Symbol &codegenvar::Symbol::operator+=(const Symbol &other)
Symbol &codegenvar::Symbol::operator-=(const Symbol &other)
Symbol &codegenvar::Symbol::operator*=(const Symbol &other)
Symbol &codegenvar::Symbol::operator/=(const Symbol &other)

Mathematical functions

The codegenvar::Symbol class has support for the following mathematical operations.

Symbol abs(const Symbol&)
Symbol log(const Symbol&)
Symbol exp(const Symbol&)
Symbol sqrt(const Symbol&)
Symbol cos(const Symbol&)
Symbol acos(const Symbol&)
Symbol sin(const Symbol&)
Symbol asin(const Symbol&)
Symbol tan(const Symbol&)
Symbol atan(const Symbol&)
Symbol sinh(const Symbol&)
Symbol cosh(const Symbol&)
Symbol tanh(const Symbol&)
Symbol floor(const Symbol&)
Symbol ceil(const Symbol &value)
Symbol pow(const Symbol &lhs, const Symbol &rhs)

Logical operations

The codegenvar::Symbol class has support for the following boolean operations.

Note

If you plan to use these boolean operations, have a look at Conditional statements.

bool codegenvar::operator==(const Symbol &lhs, const Symbol &rhs)
bool codegenvar::operator<(const Symbol &lhs, const Symbol &rhs)
bool codegenvar::operator>(const Symbol &lhs, const Symbol &rhs)
bool codegenvar::operator!=(const Symbol &lhs, const Symbol &rhs)
bool codegenvar::operator<=(const Symbol &lhs, const Symbol &rhs)
bool codegenvar::operator>=(const Symbol &lhs, const Symbol &rhs)