I have several times seen a construct
template foo(T...) if(T.length == 1)
{
...
}
What is that good for?
Why using variadic parameter if anyway exactly one parameter is
required?!?
On Wednesday, 20 August 2014 at 15:11:53 UTC, Dominikus Dittes
Scherkl wrote:
I have several times seen a construct
template foo(T...) if(T.length == 1)
{
...
}
What is that good for?
Why using variadic parameter if anyway exactly one parameter is
required?!?
AFAIK, it's a historical
On Wednesday, 20 August 2014 at 15:26:14 UTC, monarch_dodra wrote:
AFAIK, it's a historical workaround to accept T as either alias
or not alias, as varargs have auto alias. EG:
foo!int //OK
foo!hello //OK too
Ah, ok.
And why historical? Is that not necessary anymore? What better
solution is
On Wednesday, 20 August 2014 at 15:11:53 UTC, Dominikus Dittes
Scherkl wrote:
I have several times seen a construct
template foo(T...) if(T.length == 1)
{
...
}
What is that good for?
Why using variadic parameter if anyway exactly one parameter is
required?!?
That's because template
On Wed, Aug 20, 2014 at 5:34 PM, Dominikus Dittes Scherkl via
Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On Wednesday, 20 August 2014 at 15:26:14 UTC, monarch_dodra wrote:
AFAIK, it's a historical workaround to accept T as either alias or not
alias, as varargs have auto
On Wednesday, 20 August 2014 at 15:37:18 UTC, Philippe Sigaud via
Digitalmars-d-learn wrote:
No better solution that I know of.
alias template parameters (alias a) match symbols (names,
user-defined
types) whereas type parameter (T) match only pure types.
So when we need to match anything,
On Wednesday, 20 August 2014 at 15:34:30 UTC, Dominikus Dittes
Scherkl wrote:
And why historical? Is that not necessary anymore? What better
solution is there today?
Historical in a sense that distinct can be anything template
parameter is probably a better approach but it is too late to
On Wednesday, 20 August 2014 at 17:02:59 UTC, Dicebot wrote:
On Wednesday, 20 August 2014 at 15:34:30 UTC, Dominikus Dittes
Scherkl wrote:
And why historical? Is that not necessary anymore? What better
solution is there today?
Historical in a sense that distinct can be anything template
On Wed, 20 Aug 2014 17:47:36 +
monarch_dodra via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Yeah, what he said. It's a language artifact.
by the way, it would be nice to have wiki page with such artifacts and
their explanations.
signature.asc
Description: PGP signature