25 #include "antares/expressions/nodes/Node.h"
27 namespace Antares::Expressions::Nodes
31 concept NodePtr = std::same_as<T, Node*>;
33 template<
typename T,
typename... Args>
34 requires(std::convertible_to<Args, T> && ...)
35 std::vector<T> createVector(T first, Args... args)
37 return std::vector<T>{first, args...};
43 template<
typename... NodePtr>
46 if constexpr (
sizeof...(NodePtr))
48 operands_ = createVector(
static_cast<Node*
>(operands)...);
57 explicit ParentNode(
const std::vector<Node*>& operands);
65 operands_(std::move(operands))
75 const std::vector<const Node*> getConstOperands()
const;
77 Node* operator[](std::size_t idx)
const;
82 std::vector<Node*> operands_ = {};
Base class for nodes in a syntax tree.
Definition: Node.h:30
Definition: ParentNode.h:41
const std::vector< Node * > & getOperands() const
Retrieves the operands of the parent node.
Definition: ParentNode.cpp:31
ParentNode(std::vector< Node * > &&operands)
Constructs a parent node with the specified operands. Vector is moved.
Definition: ParentNode.h:64