Hi all,
I'm trying to get the following code to work.
(This code is a simplified version of some algebraic type).
Is it possible to only declare one version of the 'apply'
function?
Or should I declare the const version and the non-const version?
I tried using "inout", but I got the following
On Saturday, 24 October 2015 at 08:51:58 UTC, Sebastien Alaiwan
wrote:
Hi all,
I'm trying to get the following code to work.
(This code is a simplified version of some algebraic type).
Is it possible to only declare one version of the 'apply'
function?
Or should I declare the const version and
Hi ponce,
Thanks for your suggestion.
I think I may have found the beginning of a solution:
class E
{
import std.traits;
void apply(this F, U)(void delegate(U e) f)
if(is(Unqual!U == E))
{
f(this);
}
int val;
}
int main()
{
void setToZero(E e)
{
e.val = 0;
}
void
On Saturday, 24 October 2015 at 11:28:17 UTC, Sebastien Alaiwan
wrote:
Hi ponce,
Thanks for your suggestion.
I think I may have found the beginning of a solution:
class E
{
import std.traits;
void apply(this F, U)(void delegate(U e) f)
if(is(Unqual!U == E))
{
f(this);
}
int v