On Monday, 13 March 2017 at 14:47:20 UTC, H. S. Teoh wrote:
On Sat, Mar 11, 2017 at 08:07:39PM +, XavierAP via
Digitalmars-d-learn wrote: [...]
But I still like the version with pointers ;)
There's nothing wrong with using pointers in D. The fact that
D alleviates most cases of
On Sat, Mar 11, 2017 at 08:07:39PM +, XavierAP via Digitalmars-d-learn
wrote:
[...]
> I realized that the code that sparked the question made no sense and
> should be done in a different way... As is always the case when these
> questions come up.
> But I still like the version with pointers
On Saturday, 11 March 2017 at 19:15:59 UTC, H. S. Teoh wrote:
What about just:
foreach (const ref p; [in1, in2, in3, in4])
I would think there will be already one copy from the local
parameter variables to the in situ array. Then from that one into
the for each element it's ref'd
On Sat, Mar 11, 2017 at 12:45:10PM +, XavierAP via Digitalmars-d-learn
wrote:
> On Saturday, 11 March 2017 at 12:35:42 UTC, XavierAP wrote:
> > I do not really think it's a bad solution, to check several scalar
> > arguments that must obey the same condition; just wondering if you
> > have
On Saturday, 11 March 2017 at 14:49:42 UTC, XavierAP wrote:
But also I don't want to modify the function signature,
certainly in this way.
It is already copied by the time you get in to the function
though because of the signature (unless they are constructed
in-place at the call site).
On Saturday, 11 March 2017 at 13:44:30 UTC, Satoshi wrote:
void calc(in double[] array...) {
foreach (x; array) { }
}
To do what I want it should be foreach(ref x; array) -- or const
ref. But also I don't want to modify the function signature,
certainly in this way. In another situation
On Saturday, 11 March 2017 at 12:35:42 UTC, XavierAP wrote:
I do not really think it's a bad solution, to check several
scalar arguments that must obey the same condition; just
wondering if you have better ideas. Try to avoid modifying the
function's signature and defining custom types, unless
On Saturday, 11 March 2017 at 12:35:42 UTC, XavierAP wrote:
I do not really think it's a bad solution, to check several
scalar arguments that must obey the same condition; just
wondering if you have better ideas. Try to avoid modifying the
function's signature and defining custom types, unless
Oh... please forget it
What a terrible example :p I forgot why I was using pointers at
all... I must have had a reason to write this in the past ???
I do not really think it's a bad solution, to check several
scalar arguments that must obey the same condition; just
wondering if you have better ideas. Try to avoid modifying the
function's signature and defining custom types, unless you have a
really terrific idea.
void calc(double in1,
10 matches
Mail list logo