This is not currently allowed by the syntax; structured bindings are a simple-declaration:
simple-declaration:[…]
– attribute-specifier-seqopt decl-specifier-seq ref-qualifieropt[
identifier-list]
initializer;
while function parameters are introduced by a parameter-declaration-list, which contains declarators:
The declarators specify the names of these entities and (optionally) modify the type of the specifiers with operators such as
*
(pointer to) and()
(function returning).
That is, a structured binding is a (block-level) statement syntax – you can see this by noting that the grammar for it ends in a semicolon ;
. Allowing structured bindings in a lambda parameter list would require additional grammar to be added.
It sounds like a good idea, and I can’t immediately see any ambiguity in the syntax; it would certainly be worth discussing as it solves your presented use case nicely and more concisely than the alternatives.