Class ExprPtr

Inheritance Relationships

Base Type

  • public std::shared_ptr< Expr >

Class Documentation

class ExprPtr : public std::shared_ptr<Expr>

ExprPtr is a multiple-owner smart pointer to Expr.

It can be used mostly interchangeably with std::shared_ptr<Expr>, but also provides convenient mathematical operators (+=, etc.)

Public Types

using base_type = std::shared_ptr<Expr>

Public Functions

ExprPtr() = default
ExprPtr(const ExprPtr&) = default
ExprPtr(ExprPtr&&) = default
template<typename E, typename = std::enable_if_t<std::is_same_v<std::remove_const_t<E>, Expr> || std::is_base_of_v<Expr, std::remove_const_t<E>>>>
inline ExprPtr(const std::shared_ptr<E> &other_sptr)
template<typename E, typename = std::enable_if_t<is_an_expr_v<E>>>
inline ExprPtr(std::shared_ptr<E> &&other_sptr)
template<typename E, typename = std::enable_if_t<is_an_expr_v<E>>>
inline ExprPtr &operator=(const std::shared_ptr<E> &other_sptr)
template<typename E, typename = std::enable_if_t<is_an_expr_v<E>>>
inline ExprPtr &operator=(std::shared_ptr<E> &&other_sptr)
ExprPtr &operator=(const ExprPtr&) = default
ExprPtr &operator=(ExprPtr&&) = default
~ExprPtr() = default
ExprPtr clone() const &

See also

Expr::clone()

Returns:

a copy of this object

ExprPtr clone() && noexcept

Note

this object is null after the call

Returns:

a moved copy of this object

base_type &as_shared_ptr() &
const base_type &as_shared_ptr() const &
base_type &&as_shared_ptr() &&
template<typename E, typename = std::enable_if_t<!is_expr_v<E>>>
inline std::shared_ptr<E> as_shared_ptr() const
Expr &operator*() &

dereference operator

Returns:

non-const lvalue reference to the contained Expr object

Pre:

this->operator bool()

const Expr &operator*() const &

dereference operator

Returns:

const lvalue reference to the contained Expr object

Pre:

this->operator bool()

Expr &&operator*() &&

dereference operator

Returns:

non-const rvalue reference to the contained Expr object

Pre:

this->operator bool()

ExprPtr &operator+=(const ExprPtr &other)

in-place addition operator

if this is non-null, adds other to the contained expressions, otherwise will make this point to a clone of other (see Expr::clone())

Parameters:

other – expression to add to this

Returns:

reference to *this

ExprPtr &operator-=(const ExprPtr&)

in-place subtraction operator

if this is non-null, subtracts other from the contained expressions, otherwise will make this point to the negative of a clone of other (see Expr::clone())

Parameters:

other – expression to add to this

Returns:

reference to *this

ExprPtr &operator*=(const ExprPtr&)

in-place multiplication operator

if this is non-null, multiplies the contained expressions by other , otherwise will make this point to a clone of other (see Expr::clone())

Parameters:

other – expression to add to this

Returns:

reference to *this

template<typename T>
bool is() const
Template Parameters:

T – an Expr type

Returns:

true if this object is of type T

template<typename T>
const T &as() const
Template Parameters:

T – an Expr type

Returns:

this object cast to type T

template<typename T>
T &as()
Template Parameters:

T – an Expr type

Returns:

this object cast to type T

std::wstring to_latex() const