The current function type does not support generic lambdas because it
relies on the lambda being implicitly convertible to a function pointer.
This patch adds support for this by copying the existing lightweight
function_ref type.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/__support/CPP/functional.h | ||
---|---|---|
22 | I am a bit confused by the naming. ISO C++ is going to call it std::function_ref. |
libc/src/__support/CPP/functional.h | ||
---|---|---|
22 | It used to be called cpp::function and I'm basically copying llvm::function_ref, so I just changed the name for consistency. |
libc/src/__support/CPP/functional.h | ||
---|---|---|
46 | As suggested on discord, can we just replace this with __is_convertible? Minimum clang version we support is 11 and gcc version 12.2: https://libc.llvm.org/compiler_support.html |
libc/src/__support/CPP/functional.h | ||
---|---|---|
46 | Since I ended up writing it the more generic way I'm somewhat tempted to keep it, but I try to change it. |
libc/src/__support/CPP/type_traits.h | ||
---|---|---|
171 | Sorry, I meant commentary for void(static_cast<T (*)()>(nullptr)) in line 175 and for void(declval<void (&)(T)>()(declval<F>())) on line 179. |
The impolementation was too complicated to explain so I used one provided by "philnik" on Discord.
libc/src/__support/CPP/type_traits.h | ||
---|---|---|
182 | I think I can reason this out but I am not sure if it comprehensive. At the same time, we don't have to be comprehensive in the libc. |
I am a bit confused by the naming. ISO C++ is going to call it std::function_ref.