Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Constant.h
Go to the documentation of this file.
1
19#ifndef PYSTON_CONSTANT_H
20#define PYSTON_CONSTANT_H
21
22#include "Node.h"
23
24namespace Pyston {
25
31template <typename T>
32class Constant : public Node<T> {
33public:
39 explicit Constant(T value) : m_value{value} {}
40
44 std::string repr() const final {
45 return std::to_string(m_value);
46 }
47
53 T eval(const Context&, const Arguments&) const final {
54 return m_value;
55 }
56
60 void visit(Visitor& visitor) const final {
61 visitor.enter(this);
62 visitor.exit(this);
63 }
64
65private:
67};
68
69} // end of namespace Pyston
70
71#endif // PYSTON_CONSTANT_H
Constant(T value)
Definition Constant.h:39
void visit(Visitor &visitor) const final
Definition Constant.h:60
T eval(const Context &, const Arguments &) const final
Definition Constant.h:53
std::string repr() const final
Definition Constant.h:44
T to_string(T... args)