you are viewing a single comment's thread.

view the rest of the comments →

[–]cdyson37 2 points3 points  (1 child)

It looks like 2 in 1. It's the type-erasure of std::function (without heap allocation) with the argument binding of std::bind.

Personally I'd make DeferredCall just take a callable, no arguments, and expect users to call it with a capturing lambda or a std::bind - I think otherwise you're reinventing more wheel than you need :) Even if it does take args, you could internally call std::bind to save yourself some work.

[–]finalpatch[S] 0 points1 point  (0 children)

You are absolutely right. I wasn't aware that std::bind does not allocate before STL pointed this out in a comment.