> Yes, you can do this. You need to store proc address somewhere and it's args 
> in simple case. > Essentially, you need to wrap this code into nice macro: > 
> ...

Thank you for the answer. Yes, it's possible to call functions with predefined 
argument types/count. My question is more about the logic looking like this (in 
C++): 
    
    
    template<class F, class... Args>
    void saveForExecute(F f, Args... args) {
      auto pHolder = getSuitableHolder();
      pHolder->addTask(std::bind(f, args...));
    }
    
    saveForExecute(&test1, 10, 20);
    
    CTest *pTest = new CTest();
    saveForExecute(&CTest::test2, pTest, "Test2");
    

And for example with reflection API that would be possible. As I understand in 
_nim_ with macros it's possible to get all parameters and its types from AST. 
But I'm afraid this solution isn't stable enough: what if AST internal logic is 
slightly changed in nim 1.0 or even in 2.5? 

Reply via email to