Date: Mon, 21 Sep 2026 17:45:18 +0530
Currently structured bindings do not allow for nested bindings.
std::map<Identifier, std::pair<Handle, Context>> map;
// to get a copy of identifier, handle and info
for (const auto &[identifierRef, handleWithContextRef] : map)
{
auto identifier = identifierRef;
auto [handle, context] = handleWithContextRef;
}
// Suggested replacement
for(auto [identifier, (handle, context)]: map)
{
}
All sb-identifiers in the structured-binding-declaration will have the same
reference qualifier.
*Updated in the C++ grammar*
sb-identifier :
...opt identifier attribute-specifier-seqopt
( sb-identifier-list ) // new production rule
sb-identifier-list :
sb-identifier
sb-identifier-list , sb-identifier
structured-binding-declaration :
attribute-specifier-seqopt decl-specifier-seq ref-qualifieropt [
sb-identifier-list ]
I have attached an argument
<https://gist.github.com/Johan511/3bbae06c683fd343a08aa6c50f1de0ed> that
this won't cause any parsing ambiguities
std::map<Identifier, std::pair<Handle, Context>> map;
// to get a copy of identifier, handle and info
for (const auto &[identifierRef, handleWithContextRef] : map)
{
auto identifier = identifierRef;
auto [handle, context] = handleWithContextRef;
}
// Suggested replacement
for(auto [identifier, (handle, context)]: map)
{
}
All sb-identifiers in the structured-binding-declaration will have the same
reference qualifier.
*Updated in the C++ grammar*
sb-identifier :
...opt identifier attribute-specifier-seqopt
( sb-identifier-list ) // new production rule
sb-identifier-list :
sb-identifier
sb-identifier-list , sb-identifier
structured-binding-declaration :
attribute-specifier-seqopt decl-specifier-seq ref-qualifieropt [
sb-identifier-list ]
I have attached an argument
<https://gist.github.com/Johan511/3bbae06c683fd343a08aa6c50f1de0ed> that
this won't cause any parsing ambiguities
-- Hari Hara Naveen
Received on 2026-09-21 12:15:32
