0
votes
2answers
45 views

Personnal implementation of Java events in Slick2D

I'm making my own windowing system in Java with Slick2D right now and I want to add buttons to my windows! The thing is that I have no knowledge on events or such things... Everywhere I look it's ...
5
votes
3answers
237 views

Is there an idiomatic way to create a collection of delegates in C++?

I want to store functions with similar signature in a collection to do something like this: f(vector<Order>& orders, vector<Function>& functions) { foreach(process_orders in ...
2
votes
1answer
133 views

Implementing function delegates in C with unions and function pointers

I'd like to be able to generically pass a function to a function in C. I've used C for a few years, and I'm aware of the barriers to implementing proper closures and higher-order functions. It's ...
0
votes
0answers
131 views

How to use call backs in C++ like delegates in C#? [duplicate]

Possible Duplicate: What is a C++ delegate? I need to use a callback in C++ like delegates in C#. For example, in C# we have: ... public delegate void SomeWorkhandeler(object Arg); ... ...
3
votes
3answers
470 views

Emulating delegates with free generic type parameters in C#

This is a hard question about language design, patterns and semantics. Please, don't down-vote just because you don't see the practical value. First, let's think about functions and their parameters. ...
3
votes
2answers
134 views

Why is c++ template argument deduction failing in this case?

I am trying to write my own delegate system as a replacement for boost::functions since the latter does a lot of heap-allocations which I profiled to be problematic. I have written this as a ...
2
votes
2answers
651 views

Using std::function as a delegate in C++11

Say I have these 3 different functions that I may want to point to: float test1(int a, int b) { return 7.0f; } struct TestClass { float test2(int a, int b) { return 5.0f; } }; ...
0
votes
0answers
184 views

Convert Member Function Pointer to IntPtr

I want to Use a Managed Delegate in a Native Class. It seems I should using Marshal::GetDelegateForFunctionPointer. I write my function pointer as is: typedef void (CMYClass::*FUNCP)(int i); then ...
3
votes
3answers
128 views

Why the delegates or the closures are often referred as true “object-oriented function pointers” ? - about C++

For example, considering the C# Unlike function pointers in C or C++, delegates are object-oriented, type-safe, and secure. source: ...
0
votes
2answers
302 views

C: Example of unsafe of function pointer compare to delegate of C#

When I learn delegate of C#, my book said that delegate same with function pointer in C, but more safer. After I read that line, I think : Ah, so C Compiler will not check prototype where the function ...
2
votes
1answer
108 views

Calling C++ DLLs from C# ESP value

So I have a DLL that I made with C++ and I am using it in C#. The problem is that I use a function pointer in C++, so I made a delegate. The hole program works but after it finishes I got a message ...
1
vote
4answers
155 views

How to create C# delegate double callable like this `f(a + k * h)`?

I have created a public delegate double DynamicFunc(double x); and now I try to create an instance of it to pass into a component later private DynamicFunc f(double x) { return ...
-1
votes
5answers
120 views

Which one of these approaches would yield the fastest runtime? [closed]

I am in the midst of a short thought experiment and would love some assistance. Consider a class that calculates some output according to a function that itself can be changed, but can only be ...
3
votes
1answer
389 views

window.external.notify passing data other than string

I am trying to write a windows phone app and I want to invoke a delegate when a user wants performs an action. But the problem is the action has to be performed in the webpage and the event has to be ...
1
vote
3answers
164 views

c++, perform function on every array member

i have a question regaring c++ and arrays. let say i have a class which is called CustomArray, and is nothing more than an generic array wich has attributes for size and capacity, to make the array ...

1 2
15 30 50 per page