Vector of std::function with different signatures

前端 未结 7 1770
离开以前
离开以前 2020-12-03 03:32

I have a number of callback functions with different signatures. Ideally, I would like to put these in a vector and call the appropriate one depending on certain conditions.

7条回答
  •  醉酒成梦
    2020-12-03 04:21

    If you've got an int and a string, you cannot put them in one vector but you can put them in one struct or std::tuple<>. The same applies for two function types.

提交回复
热议问题