On Sunday, 13 September 2020 at 01:25:43 UTC, mw wrote:
On Saturday, 12 September 2020 at 20:29:40 UTC, Paul Backus
If you have a "real-life" application in mind for this, I'd be
curious to hear what it is.
I'm wrapping a C library, trying to write a single D function /
template that can
On Sunday, 13 September 2020 at 12:34:06 UTC, 60rntogo wrote:
However, if I directly insert the contents of X into Bar
instead of mixing it in, it compiles just fine. What's going on
here?
You can override members from mixin templates by giving a member
with the same *name* (not the same
On Sunday, 13 September 2020 at 07:00:36 UTC, mw wrote:
Here it is: D wrapper for https://ta-lib.org/
https://github.com/mingwugmail/talibd
I end up using C macro to generate D functions, the single
template is this one:
This code:
---
mixin template X()
{
int[2] x;
this(int[2] x...)
{
this.x = x;
}
}
struct Foo
{
}
struct Bar
{
mixin X;
this(Foo foo)
{
this.x = [0, 0];
}
}
void main()
{
auto bar = Bar(1, 2);
}
---
produces the following error:
---
source/app.d(27,17): Error:
Hi,
i would like to create a function which takes the first parameter
as a reference to a struct - but assure the calle that the
reference is read-only. Can this be done?
If i am not mistaken, then the "in" Parameter Storage Class is
what i want(?). But the documentation states that this
Hi all,
I am trying to implement a sweep method for a 2D Red-black
Gauss-Seidel Solver with the help of mir and its slices.
The fastest Version I discovered so far looks like this:
```
void sweep(T, size_t Dim : 2, Color color)(in Slice!(T*, 2) F,
Slice!(T*, 2) U, T h2)
{
const auto m =
On Sunday, 13 September 2020 at 13:10:15 UTC, Adam D. Ruppe wrote:
This is pretty useful in a lot of cases but kinda annoying with
overloading. To overload, you must use `alias` to merge the
overload sets. For constructors, you need to use the name
`__ctor` instead of `this` to make it
On Sunday, 13 September 2020 at 13:35:15 UTC, Martin wrote:
Hi,
i would like to create a function which takes the first
parameter as a reference to a struct - but assure the calle
that the reference is read-only. Can this be done?
Yes, you can do this with `ref const`.
Summary:
Can a typesafe D variadic function, or D variadic template pass its
parameters to a C variadic function?
Background:
I maintain a library binding [0] to htslib, a high-performance and very
widely used C library for high-throughput sequencing (hts) data files.
We use this internally
On 9/13/20 12:55 PM, James Blachly wrote:
Summary:
Can a typesafe D variadic function, or D variadic template pass its
parameters to a C variadic function?
Background:
I maintain a library binding [0] to htslib, a high-performance and very
widely used C library for high-throughput sequencing
On Sunday, 13 September 2020 at 17:23:42 UTC, Steven
Schveighoffer wrote:
On 9/13/20 12:55 PM, James Blachly wrote:
```
/// Add a single line to an existing header
auto addLine(T...)(RecordType type, T kvargs)
if(kvargs.length > 0 && isSomeString!(T[0]))
{
static
On Sunday, 13 September 2020 at 10:16:46 UTC, Paul Backus wrote:
On Sunday, 13 September 2020 at 07:00:36 UTC, mw wrote:
Here it is: D wrapper for https://ta-lib.org/
https://github.com/mingwugmail/talibd
I end up using C macro to generate D functions, the single
template is this one:
```
/// Add a single line to an existing header
auto addLine(T...)(RecordType type, T kvargs)
if(kvargs.length > 0 && isSomeString!(T[0]))
{
static assert (kvargs.length %2 == 0); // K-V pairs => even
number of variadic args
string varargMagic(size_t
On 9/13/20 2:35 PM, ag0aep6g wrote:
Easy peasy:
import std.meta: Repeat;
Repeat!(kvargs.length, const(char)*) zs;
foreach (i, ref z; zs) z = toStringz(kvargs[i]);
return sam_hdr_add_line(this.h, type.ptr, zs, null);
Great, thank you!
By the way, `kvargs`
On 9/13/20 2:35 PM, Paul Backus wrote:
On Sunday, 13 September 2020 at 17:23:42 UTC, Steven Schveighoffer wrote:
On 9/13/20 12:55 PM, James Blachly wrote:
```
/// Add a single line to an existing header
auto addLine(T...)(RecordType type, T kvargs)
if(kvargs.length > 0 &&
On Sunday, 13 September 2020 at 14:48:30 UTC, Christoph wrote:
Hi all,
I am trying to implement a sweep method for a 2D Red-black
Gauss-Seidel Solver with the help of mir and its slices.
The fastest Version I discovered so far looks like this:
```
void sweep(T, size_t Dim : 2, Color color)(in
On Sunday, 13 September 2020 at 18:24:01 UTC, mw wrote:
But, I'd reflect on my experience so far on compile-time
meta-programming in D as a novice user, the big problems are:
-- in D, there are too many choices, with no clear guideline
which one is *THE* one to use for a particular purpose:
Just a observation, from the questions & answers in this thread
and mine[1]: I think meta-programming in D is somehow like C++,
it starts becoming a baroque language. The language is complex
enough that there may be ways to get things done, but it's just
quite difficult for ordinary users to
Consider the enum:
enum Foo { a, b }
Foo.a.stringof => "a"
enum x = Foo.a;
x.stringof => "cast(Foo)0"
Is there another way I can take an enum value that's known at compile
time (but not the actual identifier), and get the name of it? I know I
can use a switch, or to!string. But I was hoping
19 matches
Mail list logo