Alexandria  2.27.0
SDC-CH common library for the Euclid project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
24 namespace Pyston {
25 
31 template <typename T>
32 class Constant : public Node<T> {
33 public:
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 
65 private:
67 };
68 
69 } // end of namespace Pyston
70 
71 #endif // PYSTON_CONSTANT_H
T to_string(T...args)
Constant(T value)
Definition: Constant.h:39
STL class.
std::string repr() const final
Definition: Constant.h:44
STL class.
void visit(Visitor &visitor) const final
Definition: Constant.h:60
STL class.
T eval(const Context &, const Arguments &) const final
Definition: Constant.h:53