On this page:
https://tour.dlang.org/tour/en/basics/delegates
there is:
void doSomething(int function(int, int) doer) {
// call passed function
doer(5,5);
}
doSomething(add); // use global function `add` here
// a
Code:
module matrix;
import std.array;
struct Matrix(E)
{
private:
E[][];
this() {
}
void deleteRow(int i)
{
E = E[0..i] ~ E[i..$];
}
void deleteColumn(int j)
{
for (int i=0; i < E.length; i++)
{
E[i] = E[i][0..j] ~ E[i][j..$];
On Wednesday, 27 December 2017 at 21:42:53 UTC, Mengu wrote:
On Wednesday, 27 December 2017 at 21:39:49 UTC, Mengu wrote:
On Wednesday, 27 December 2017 at 20:54:17 UTC, bitwise wrote:
[...]
there's also a simple workaround for fields with the same
type: https://run.dlang.io/is/dsFajq
impo
On Wednesday, 27 December 2017 at 21:39:49 UTC, Mengu wrote:
On Wednesday, 27 December 2017 at 20:54:17 UTC, bitwise wrote:
[...]
there's also a simple workaround for fields with the same type:
https://run.dlang.io/is/dsFajq
import std.stdio;
struct S {
int x;
int y;
}
auto setValue(r
On Wednesday, 27 December 2017 at 20:54:17 UTC, bitwise wrote:
On Wednesday, 27 December 2017 at 20:04:29 UTC, Marc wrote:
I'd like to set the members of a class by its name at runtime,
I would do something like this:
__traits(getMember, myClass, name) = value;
but since name is only know a
On Wednesday, 27 December 2017 at 20:04:29 UTC, Marc wrote:
I'd like to set the members of a class by its name at runtime,
I would do something like this:
__traits(getMember, myClass, name) = value;
but since name is only know at runtime, I can't use __traits().
What's a workaround for this
On Wednesday, 27 December 2017 at 18:08:19 UTC, Bastiaan Veelo
wrote:
I suppose the following is not a bug, but confusing it is:
```
void main()
{
import std.stdio;
import std.bitmanip;
BitArray ba = [1, 1, 1, 1, 1, 1, 1, 1];
writeln(ba);// [1, 1, 1, 1, 1, 1, 1, 1]
ba
On Wednesday, 27 December 2017 at 20:04:29 UTC, Marc wrote:
I'd like to set the members of a class by its name at runtime,
I would do something like this:
__traits(getMember, myClass, name) = value;
but since name is only know at runtime, I can't use __traits().
What's a workaround for this
I'd like to set the members of a class by its name at runtime, I
would do something like this:
__traits(getMember, myClass, name) = value;
but since name is only know at runtime, I can't use __traits().
What's a workaround for this?
I suppose the following is not a bug, but confusing it is:
```
void main()
{
import std.stdio;
import std.bitmanip;
BitArray ba = [1, 1, 1, 1, 1, 1, 1, 1];
writeln(ba);// [1, 1, 1, 1, 1, 1, 1, 1]
ba >>= 4; // right shift
writeln(ba);// [1, 1, 1,
On Wednesday, 27 December 2017 at 13:40:28 UTC, rumbu wrote:
Is that normal?
use std.math;
float f = float.max;
f += 1.0;
assert(IeeeFlags.overflow) //failure
assert(f == float.inf) //failure, f is in fact float.max
On the contrary, float.max + float.max will overflow. The
behavior is the same
Is that normal?
use std.math;
float f = float.max;
f += 1.0;
assert(IeeeFlags.overflow) //failure
assert(f == float.inf) //failure, f is in fact float.max
On the contrary, float.max + float.max will overflow. The
behavior is the same for double and real.
On Monday, December 25, 2017 15:00:19 aliak via Digitalmars-d-learn wrote:
> On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote:
> > Does to!(string)(char[]) do any memory allocation on conversion
> > or is this similar to a cast or what else?
>
> As said it calls idup, which calls _trustedDup
On Monday, December 25, 2017 12:11:58 Mike Franklin via Digitalmars-d-learn
wrote:
> But we need people to use -dip25 and -dip1000 and provide
> feedback, submit bug reports, etc.. so we can move the
> implementation forward.
Anyone who wishes to play around with those flags is free to do so, and
14 matches
Mail list logo