function2 icon indicating copy to clipboard operation
function2 copied to clipboard

Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more

Results 20 function2 issues
Sort by recently updated
recently updated
newest added

Starting with Visual Studio 2022 (17.3.0) the following warning is emitted: ``` include\function2\function2.hpp(1176): warning C4305: '': truncation from 'bool (__cdecl *)(void)' to 'bool' ``` Neither `bool(callable)` (as it was written),...

@Naios ----- ### Commit Hash Function2 tags 4.2.0 and 4.2.1, hashes: 02ca99831de59c7c3a4b834789260253cace0ced f569a63cfe369df867a1a4d17aaa12269156536c ### Expected Behavior Test case pasted below compiles without errors with `g++-11 -O1 -Wnull-dereference -c -o null-deref.o...

@Naios Here are some suggestions about `fu2::function_base`. 1. There are too many boolean template parameters. It's hard to imagine what specific combination of policies are given if we just write...

feature-request

@Naios Suggestion For example, ``` using MyFunction = fu2::function_base; auto cb = [foo, bar] {}; static_assert(MyFunction::is_inplace(cb), "Lambda too big!") ``` This could be useful to maintain code over time and...

feature-request

@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)...

feature-request

@Naios This is relatively minor, but I thought I'd mention it before I forget about them: building `function2` strictly as a copied header with `clang` can trigger a few warnings,...

minor

@Naios ----- ### Commit Hash e3695b4b4fa3c672e25c6462d7900f8d2417a417 ### Expected Behavior When trying to make a fu2::function with a move-only object, you get an assert_error with the message "Can't wrap a non...

minor

@Naios ----- ### Commit Hash Git Tag 3.1.0 ### Expected Behavior As Rvalue functions are meant to be single shot functions, the second invocation should result in raising a bad_function_call...

minor

@Naios ----- ### Expected Behavior The const-ness of the callable should be propagated to the erased function pointer ### Actual Behavior ``` In file included from main.cpp:1:0: function2.hpp: In instantiation...

bug

@Naios Great improvement over std::function, but there is no [std::function::target](http://www.cplusplus.com/reference/functional/function/target/) counterpart. I use it for logging addresses of underlying callable objects, very useful for debugging: ```c++ ... catch (const std::exception...

feature-request