Fattorino/ImNodeFlow

Forwarding Arguments to Derived Node Constructor

Closed this issue · 2 comments

It would be useful to have the option to forward constructor arguments to the derived class when performing addNode to get more reusable behaviour out of user defined node types without having to pass them in through some alternate mechanism.

Could you provide a small example? I'm not sure if I understood your message correctly

Something like this

struct A : ImFlow::BaseNode {
  explicit A(const std::string &name, ImVec2 pos, ImFlow::ImNodeFlow *inf, int numIns)
  : BaseNode(name, pos, inf)
  {
     // Do something with numIns like dynamically sizing number of inputs
  }
  // Rest of methods
};

addNode<A>("A", 2); // not sure if this exact syntax is possible