[swift-evolution] [pitch] One-sided Ranges

Félix Cloutier felixcca at yahoo.ca
Thu Apr 13 21:29:40 CDT 2017


template<typename... T>
void foo(T... args)
{
	return bar(args...);
}

In this bad but simple example, bar is called with the same* parameters as foo. Parameter unpacking uses the postfix … operator.

* To some extent. Doing the right thing adds a lot of noise.

> Le 13 avr. 2017 à 11:18, David Sweeris <davesweeris at mac.com> a écrit :
> 
> 
>> On Apr 12, 2017, at 20:31, Félix Cloutier via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I don't have a strong opinion; are we sure enough that this is what we want the postfix operator … to be for? For instance, C++ uses it a lot with variadic templates.
> 
> I don't think the two usages conflict... maybe later if "literal values as generic parameters" and "variadic generic parameters" get added, there might be a problem involving variadic literal one-sided ranges, but otherwise we should be good on that front... I think...
> 
> I should probably learn more about how C++ templates have changed since they were first introduced.
> 
> - Dave Sweeris



More information about the swift-evolution mailing list