Naios / function2

Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more
http://naios.github.io/function2
Boost Software License 1.0
539 stars 47 forks source link

Please add an analogue of emplace #31

Open adamemerson opened 4 years ago

adamemerson commented 4 years ago

@Naios

Being able to construct an object rather than having to copy/move one in would be very useful, particularly for objects that may be expensive to construct, or (for unique_function) immovable objects. (After all, if they're on the heap we can still move the pointer.)


Commit Hash

7cd95374b0f1c941892bfc40f0ebb6564d33fdb9

Expected Behavior

Being able to type something like fun.emplace<Foo>(something, something)

Actual Behavior

Needing to type fun = Foo(something, something)

Steps to Reproduce

N/A

Your Environment

Naios commented 4 years ago

This sounds like a promising feature. Probably I will implement it in the future.