Nov 25, 2025

[C++] lambda restrictions

Lambda Restrictions (as of c++26)

  • No implicit conversions, e.g. base class slicing
  • No member typedef
  • No compiler-selected overloading
  • No user-defined conversion functions
  • No user-defined implicit copy/move operations
  • No user-defined destructors
  • Limited template argument deduction
  • No directly extendable overload sets
  • No operator overloading
  • No array captures (at runtime. For compile time known size array, just like defined in struct, they are verbatimly copied/captured)
  • No separating declaration and definition
  • No linking across TUs (a lambda's type is effectively "private" to the file it is written in.)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.