On Tuesday, 24 May 2022 at 02:55:06 UTC, Tejas wrote:
On Tuesday, 24 May 2022 at 02:29:38 UTC, cc wrote:
```d
import core.memory;
import core.stdc.stdlib : malloc, free;
import core.lifetime : emplace;
[...]
FWIW your code will compile if you add `extern(C++)` to `Foo`
Interesting, thanks.
On Tuesday, 24 May 2022 at 02:29:38 UTC, cc wrote:
```d
import core.memory;
import core.stdc.stdlib : malloc, free;
import core.lifetime : emplace;
[...]
FWIW your code will compile if you add `extern(C++)` to `Foo`
```d
import core.memory;
import core.stdc.stdlib : malloc, free;
import core.lifetime : emplace;
T NEW(T, Args...)(auto ref Args args) /*@nogc*/ if (is(T ==
class)) {
enum size = __traits(classInstanceSize, T);
void* mem = malloc(size);
scope(failure) free(mem);
On Monday, 23 May 2022 at 23:07:00 UTC, zoujiaqing wrote:
On Sunday, 22 May 2022 at 23:34:19 UTC, mw wrote:
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:
Does D language have task steal queue?
The requirements are high-performance, lock-free, and
thread-safe.
I have a C's liblfds
On Sunday, 22 May 2022 at 22:37:43 UTC, Stefan Koch wrote:
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:
Does D language have task steal queue?
The requirements are high-performance, lock-free, and
thread-safe.
I have one called fluffy:
https://github.com/UplinkCoder/fluffy
I am
On Sunday, 22 May 2022 at 23:34:19 UTC, mw wrote:
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:
Does D language have task steal queue?
The requirements are high-performance, lock-free, and
thread-safe.
I have a C's liblfds D wrapper:
https://github.com/mw66/liblfdsd
right now on
On 5/23/22 08:14, Vindex wrote:
> Why? Why can't I have two constructors when I use mixin?
And there is an example in Phobos:
https://dlang.org/library/std/exception/basic_exception_ctors.html
The documentation there mentions the following bug:
https://issues.dlang.org/show_bug.cgi?id=115
On Monday, 23 May 2022 at 15:14:53 UTC, Vindex wrote:
I have this code:
```
import std.array, std.exception, std.stdio;
mixin template RealizeException() {
this(string msg, string file = __FILE__, size_t line =
__LINE__) {
super(msg, file, line);
}
}
class WrongUsage : Except
I have this code:
```
import std.array, std.exception, std.stdio;
mixin template RealizeException() {
this(string msg, string file = __FILE__, size_t line =
__LINE__) {
super(msg, file, line);
}
}
class WrongUsage : Exception {
mixin RealizeException;
this(string[] me
On Monday, 23 May 2022 at 13:53:02 UTC, Adam D Ruppe wrote:
On Monday, 23 May 2022 at 13:44:53 UTC, wjoe wrote:
[...]
You can actually make this work with `construct!(int[])` rather
than plain `construct`. This is a (really annoying) deficiency
in dmd's implementation. (that sdc solved btw
On Monday, 23 May 2022 at 13:44:53 UTC, wjoe wrote:
i.construct((ulong i) {return cast(int)(i+i);}).print;
You can actually make this work with `construct!(int[])` rather
than plain `construct`. This is a (really annoying) deficiency in
dmd's implementation. (that sdc solved btw proving it
Hello,
Consider this example:
```d
module foo;
import std.stdio;
import std.algorithm;
import std.traits;
import std.range;
void print(R)(R r) {
static assert(isIterable!R);
r.each!writeln;
}
auto construct(R)(R r, ElementType!R delegate(ulong i) fn) {
static assert(isIterable!R && hasAs
On Monday, 23 May 2022 at 12:20:11 UTC, JG wrote:
I am writing an interpreter and I needed access to a string via
a pointer of type void*
I ended up wrapping it in a struct since I needed another value
anyway. Seems odd that one can't do it in a less unusual way.
OK yeah, that's the main use c
On Monday, 23 May 2022 at 12:20:11 UTC, JG wrote:
On Monday, 23 May 2022 at 11:39:22 UTC, Adam D Ruppe wrote:
On Monday, 23 May 2022 at 09:38:07 UTC, JG wrote:
Hi,
Is there any more standard way to achieve something to the
effect of:
```d
import std.experimental.allocator;
string* name
On Monday, 23 May 2022 at 11:39:22 UTC, Adam D Ruppe wrote:
On Monday, 23 May 2022 at 09:38:07 UTC, JG wrote:
Hi,
Is there any more standard way to achieve something to the
effect of:
```d
import std.experimental.allocator;
string* name = theAllocator.make!string;
```
Why do you want
On Monday, 23 May 2022 at 12:17:56 UTC, bauss wrote:
On Monday, 23 May 2022 at 11:39:22 UTC, Adam D Ruppe wrote:
On Monday, 23 May 2022 at 09:38:07 UTC, JG wrote:
Hi,
Is there any more standard way to achieve something to the
effect of:
```d
import std.experimental.allocator;
string* na
On Monday, 23 May 2022 at 11:39:22 UTC, Adam D Ruppe wrote:
On Monday, 23 May 2022 at 09:38:07 UTC, JG wrote:
Hi,
Is there any more standard way to achieve something to the
effect of:
```d
import std.experimental.allocator;
string* name = theAllocator.make!string;
```
Why do you want
On Monday, 23 May 2022 at 09:38:07 UTC, JG wrote:
Hi,
Is there any more standard way to achieve something to the
effect of:
```d
import std.experimental.allocator;
string* name = theAllocator.make!string;
```
Pointers are not used for strings in d. string is an alias for
immutable(cha
On Monday, 23 May 2022 at 09:38:07 UTC, JG wrote:
Hi,
Is there any more standard way to achieve something to the
effect of:
```d
import std.experimental.allocator;
string* name = theAllocator.make!string;
```
Why do you want that?
Easiest way I know of is to just wrap it in a struct,
Hi,
Is there any more standard way to achieve something to the effect
of:
```d
import std.experimental.allocator;
string* name = theAllocator.make!string;
```
On Monday, 23 May 2022 at 08:53:27 UTC, user1234 wrote:
On Monday, 23 May 2022 at 08:52:12 UTC, vit wrote:
On Monday, 23 May 2022 at 08:34:21 UTC, Chris Katko wrote:
D
struct pair
{
float x,y;
}
[...]
This work too:
```d
myFunction(taco, p.tupleof, burrito);
```
and you can pass a std.
On Monday, 23 May 2022 at 08:52:12 UTC, vit wrote:
On Monday, 23 May 2022 at 08:34:21 UTC, Chris Katko wrote:
D
struct pair
{
float x,y;
}
[...]
This work too:
```d
myFunction(taco, p.tupleof, burrito);
```
and you can pass a std.typecons.Tuple as well, it will expand x y
On Monday, 23 May 2022 at 08:34:21 UTC, Chris Katko wrote:
D
struct pair
{
float x,y;
}
[...]
This work too:
```d
myFunction(taco, p.tupleof, burrito);
```
On Monday, 23 May 2022 at 08:34:21 UTC, Chris Katko wrote:
D
I'm curious if you can pass a struct of values (a 'tuple'?)
with the right subfields, as if those fields occupied a
function signature. (As I write this and try to explain it, it
probably sounds impossible.)
Right now you can
D
struct pair
{
float x,y;
}
myFunction(float taco, float x, float y, float burrito)
{
// stuff
}
myfunction(_taco, _x, _y, _burrito); // call function
// But can we do this?
pair p;
myfunction(_taco, p; _burrito); // p becomes (x,y) and satisfies
the two floats in the signature
25 matches
Mail list logo