Wednesday, December 30, 2015

FeedaMail: Comments for Sutter’s Mill

feedamail.com Comments for Sutter's Mill

Comment on Trip report: Fall 2015 ISO C++ standards meeting by jmckesson

I was looking at P0144, the structured bindings proposal. I was thinking that a great extension to this would be allowing the user to unbind a template parameter pack:

template
auto func(Args …args)
{
auto {x, y, z} = args…;
auto {u, v, w} = modifier(args)…; //Can unpack over arbitrary expressions.
}

This would be exceptionally useful in template code. If there are more arguments in the binding than the parameter pack, you get a compile error. But if there are more arguments in the pack than the binding, their expressions are evaluated, but are simply discarded as if they were returned from a function without being used (so [[nodiscard]] will still complain).

Read More »
 
Delievered to you by Feedamail.
Unsubscribe

No comments:

Post a Comment