On Tuesday, 23 May 2017 at 16:38:14 UTC, Stanislav Blinov wrote:
Ah, now I think I get it. You want to store a single delegate
that could be called with different sets of arguments? No, you
can't do that: you need an actual delegate instance, and for
that, you need to know the signature, at
On Tuesday, 23 May 2017 at 18:14:34 UTC, ag0aep6g wrote:
Something like this:
import core.vararg;
import std.meta: AliasSeq, staticMap;
import std.traits: isCopyable;
struct A
{
void delegate(...) dg;
auto fun(T, U ...)(T t, auto ref U u)
{
template
On 05/23/2017 01:30 PM, Alex wrote:
And no, I can't pass it by adress, as I don't know apriori, whether the
very parameter which gets the random generator is already a part of the
variadic parameters, or a well defined ref parameter.
A (run-time) variadic delegate isn't flexible like that.
On Tuesday, 23 May 2017 at 11:45:13 UTC, Alex wrote:
On Tuesday, 23 May 2017 at 11:05:09 UTC, Stanislav Blinov wrote:
void variadic(Args...)(auto ref Args args) { /* ... */ }
This infers whether you pass lvalues or rvalues. If passing
further down the chain of such calls is needed, one can
On Tuesday, 23 May 2017 at 11:05:09 UTC, Stanislav Blinov wrote:
void variadic(Args...)(auto ref Args args) { /* ... */ }
This infers whether you pass lvalues or rvalues. If passing
further down the chain of such calls is needed, one can use
std.functional : fowrard :
yes...
void
On Tuesday, 23 May 2017 at 10:42:54 UTC, Nicholas Wilson wrote:
On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote:
On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote:
With that kind of variadics, you're not dealing with a
template. A (run-time) variadic delegate is an actual
delegate,
On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote:
On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote:
With that kind of variadics, you're not dealing with a
template. A (run-time) variadic delegate is an actual
delegate, i.e. a value that can be passed around. But the
variadic stuff is
On Tuesday, 23 May 2017 at 10:42:54 UTC, Nicholas Wilson wrote:
On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote:
On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote:
With that kind of variadics, you're not dealing with a
template. A (run-time) variadic delegate is an actual
delegate,
On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote:
On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote:
With that kind of variadics, you're not dealing with a
template. A (run-time) variadic delegate is an actual
delegate, i.e. a value that can be passed around. But the
variadic stuff is
On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote:
With that kind of variadics, you're not dealing with a
template. A (run-time) variadic delegate is an actual delegate,
i.e. a value that can be passed around. But the variadic stuff
is a bit weird to use, and probably affects performance.
On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote:
On 05/22/2017 11:04 AM, Alex wrote:
[...]
Not only is a template not an lvalue, it's not any kind of
value at all. It doesn't have a type. You can't have a variable
holding a template. You can't pass it as an argument.
But a template
On 05/22/2017 11:04 AM, Alex wrote:
3. Now the hard stuff comes. I want to templatize my delegate.
struct A(alias dg)
{
auto fun(T, U...)(T t, U u)
{
return dg!(T, U)(t, u);
}
}
struct C
{
A!dlgptr a;
/* static? */ template dlgptr(T, U...)
{
/*
On Monday, 22 May 2017 at 20:38:27 UTC, Dukc wrote:
On Monday, 22 May 2017 at 09:04:15 UTC, Alex wrote:
2. Now, I want to store the delegate in another struct. If I
want to do this, I have to define the pointer as static. This
is not intended at the beginning, but it's ok, as I know, that
the
On Monday, 22 May 2017 at 09:04:15 UTC, Alex wrote:
2. Now, I want to store the delegate in another struct. If I
want to do this, I have to define the pointer as static. This
is not intended at the beginning, but it's ok, as I know, that
the delegate would be the same across all instances of
Hi, all
I have a question, how to handle a templated delegate. However,
I'm not sure, if I'm going in the right direction, so I have
three examples, and my question is about the third.
1. Here, a struct with an alias is defined and on its creation
the delegate get known to the struct.
15 matches
Mail list logo