Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
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
24namespace Pyston {
25
31template <typename T>
32class Placeholder : public Node<T> {
33public:
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
68private:
69 unsigned m_pos;
70};
71
72} // end of namespace Pyston
73
74#endif // PYSTON_PLACEHOLDER_H
void visit(Visitor &visitor) const final
Definition Placeholder.h:63
Placeholder(const unsigned pos)
Definition Placeholder.h:39
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)