Alexandria  2.25.0
SDC-CH common library for the Euclid project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Placeholder.h
Go to the documentation of this file.
1 
19 #ifndef PYSTON_PLACEHOLDER_H
20 #define PYSTON_PLACEHOLDER_H
21 
22 #include "Node.h"
23 
24 namespace Pyston {
25 
31 template <typename T>
32 class Placeholder : public Node<T> {
33 public:
39  explicit Placeholder(const unsigned pos) : m_pos{pos} {}
40 
44  std::string repr() const final {
45  return "_" + std::to_string(m_pos);
46  }
47 
56  T eval(const Context&, const Arguments& args) const final {
57  return boost::get<T>(args.at(m_pos));
58  }
59 
63  void visit(Visitor& visitor) const final {
64  visitor.enter(this);
65  visitor.exit(this);
66  }
67 
68 private:
69  unsigned m_pos;
70 };
71 
72 } // end of namespace Pyston
73 
74 #endif // PYSTON_PLACEHOLDER_H
std::string repr() const final
Definition: Placeholder.h:44
T eval(const Context &, const Arguments &args) const final
Definition: Placeholder.h:56
T to_string(T...args)
STL class.
STL class.
Placeholder(const unsigned pos)
Definition: Placeholder.h:39
void visit(Visitor &visitor) const final
Definition: Placeholder.h:63
STL class.