Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 16, 2017 Changing template parameters | ||||
---|---|---|---|---|
| ||||
Hey, quick question! I'm messing around with std.random and noticed that you can change the boundaries parameter to be either open or closed intervals on either side. By default it is "[)". How do I change these template parameters? |
January 16, 2017 Re: Changing template parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dlearner | On Monday, 16 January 2017 at 15:32:33 UTC, Dlearner wrote:
> Hey, quick question!
>
> I'm messing around with std.random and noticed that you can change the boundaries parameter to be either open or closed intervals on either side. By default it is "[)". How do I change these template parameters?
Same way you use any template parameters,
auto i = uniform!("(]")(0, 1000);
|
January 16, 2017 Re: Changing template parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jack Stouffer | On Monday, 16 January 2017 at 15:56:16 UTC, Jack Stouffer wrote:
> Same way you use any template parameters,
>
> auto i = uniform!("(]")(0, 1000);
Also, if the template parameter consists of a single token you can omit the parens:
auto i = uniform!"(]"(0, 1000);
|
January 16, 2017 Re: Changing template parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rene Zwanenburg | On Monday, 16 January 2017 at 16:08:07 UTC, Rene Zwanenburg wrote:
> On Monday, 16 January 2017 at 15:56:16 UTC, Jack Stouffer wrote:
>> Same way you use any template parameters,
>>
>> auto i = uniform!("(]")(0, 1000);
>
> Also, if the template parameter consists of a single token you can omit the parens:
>
> auto i = uniform!"(]"(0, 1000);
Ahhh, thanks a lot!
|
Copyright © 1999-2021 by the D Language Foundation