Thank you all for the replies. I'm extremely grateful. I'll look
into each and every answer.
On Thursday, 1 December 2016 at 23:51:19 UTC, Payotz wrote:
The register method will take in delegates as an argument, but
those delegates have varied arguments themselves, so I can't
really put anything there. I know that it's got something to do
with templates so I tried my hand in it and
On Thursday, 1 December 2016 at 23:51:19 UTC, Payotz wrote:
So, to give context, I am trying to make an event manager for a
game I'm making.
I was writing the "register()" method so I ran into a problem.
The register method will take in delegates as an argument, but
those delegates have
On Thursday, 1 December 2016 at 23:51:19 UTC, Payotz wrote:
So, to give context, I am trying to make an event manager for a
game I'm making.
I was writing the "register()" method so I ran into a problem.
The register method will take in delegates as an argument, but
those delegates have
On 12/01/2016 03:51 PM, Payotz wrote:
> So, to give context, I am trying to make an event manager for a game I'm
> making.
> I was writing the "register()" method so I ran into a problem.
>
> The register method will take in delegates as an argument, but those
> delegates have varied arguments
On Thu, Dec 01, 2016 at 11:51:19PM +, Payotz via Digitalmars-d-learn wrote:
> So, to give context, I am trying to make an event manager for a game
> I'm making.
> I was writing the "register()" method so I ran into a problem.
>
> The register method will take in delegates as an argument, but
So, to give context, I am trying to make an event manager for a
game I'm making.
I was writing the "register()" method so I ran into a problem.
The register method will take in delegates as an argument, but
those delegates have varied arguments themselves, so I can't
really put anything
On Thursday, 14 April 2016 at 06:27:29 UTC, Ali Çehreli wrote:
On 04/13/2016 04:39 PM, Alex wrote:
> import std.algorithm;
> indarr.map!(a => partial!(sg, a));
I think you want to generate a different delegate for each
element where the first argument to sg is the value of that
element (0,
On Thursday, 14 April 2016 at 05:54:38 UTC, David Skluzacek wrote:
So, that message is a pretty cryptic, but the problem there is
that map does its thing at runtime, but partial is a template
and must be instantiated at compile time.
Instead you can use std.meta.staticMap, by doing something
On 04/13/2016 04:39 PM, Alex wrote:
> import std.algorithm;
> indarr.map!(a => partial!(sg, a));
I think you want to generate a different delegate for each element where
the first argument to sg is the value of that element (0, 1, etc.).
Since the second element of sg is a Props, you then
So, that message is a pretty cryptic, but the problem there is
that map does its thing at runtime, but partial is a template and
must be instantiated at compile time.
Instead you can use std.meta.staticMap, by doing something like
this:
void main()
{
import std.stdio;
import
Hi at all!
Having read this:
http://forum.dlang.org/post/mailman.2415.1354291433.5162.digitalmars-d-le...@puremagic.com
still have a problem...
Lets begin with what works:
enum Props{p1, p2}
class AA
{
int[] arr1;
int[] arr2;
this()
{
//arbitrary values...
arr1
the following code seem problematic to compile...
import std.algorithm;
private alias void delegate(int, int) SlotDelegate;
class A
{
void DIT(int a, int b)
{
}
}
int main(string[] argv)
{
A a;
SlotDelegate x= a.DIT;
SlotDelegate[] _slotDg;
_slotDg.remove(x);
Remove takes an offset, not a value as far as I know.
If you need fast lookup and removal you could use hashes instead:
int main(string[] argv)
{
auto a = new A;
SlotDelegate x = a.DIT;
bool[SlotDelegate] _slotDg;
_slotDg.remove(x);
return 0;
}
There is a remove() method in std.algorithm!I even got asked why I was
reimplementing it!
(well, because I didn't know it existed hey!)
works fine with, say, int...
but not with delegate!
associative array will solve the problem indeed.. (I hope) but they use way
more memory!
it would be
15 matches
Mail list logo