SXEval 1.0.3
A generic s-expression interpreter library.
Loading...
Searching...
No Matches
Value.hpp
Go to the documentation of this file.
1#ifndef SXEVAL_VALUE_HPP
2#define SXEVAL_VALUE_HPP
3
4#include "sxeval/IOperand.hpp"
5#include <string>
6
7
8/* DEFINITIONS */
9
10namespace sxeval {
11
19template <typename T>
20class Value : public virtual IOperand<T> {
21public:
27 inline Value(T val) : _val(val) {}
28
34 inline T& getResult() override { return _val; }
35
36 inline std::string toString() const override {
37 return std::to_string(_val); }
38
39private:
40 T _val;
41
42};
43
44} /* namespace sxeval */
45#endif /* SXEVAL_VALUE_HPP */
The IOperand class is an interface for operands.
Definition IOperand.hpp:16
The Value class represents a constant value in the SXEval library.
Definition Value.hpp:20
Value(T val)
Default constructor.
Definition Value.hpp:27
T & getResult() override
Get a reference to the value.
Definition Value.hpp:34
std::string toString() const override
String representation of the instruction.
Definition Value.hpp:36
Definition AOperation.hpp:8
std::enable_if< std::is_unsigned< T >::value, T >::type Absolute(const T &a)
Perform an absolute value operation on types T.
Definition utils.hpp:262