Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
58 views

Suppose I have a function like this. How can I get a reference to that function and then call it? function Hello($name) { Write-Output "Hello, $name" }
dan-gph's user avatar
  • 17.1k
3 votes
1 answer
270 views

What are the differences between the new std::function_ref, that was added to C++26, and a "delegate"? Are they the same? By "delegate" I mean: A type that has sizeof(...) == 16. ...
levzettelin's user avatar
  • 3,062
4 votes
1 answer
65 views

Here's a minimal example of my problem: innerFunc([2, 4, 5]) % works fine outerFunc(innerFunc, [2, 4, 5]) % doesn't work function out = innerFunc(my_vec) my_vec % not recogniced when called from ...
haifisch123's user avatar
3 votes
1 answer
97 views

This is a niche question, but I'm struggling to find a sufficient answer. Struct members can be const, but can a function pointer/reference member be declared const? Based off my reading of C++17 ...
JWCS's user avatar
  • 1,223
-1 votes
2 answers
74 views

I'm not sure, if I'm using the correct term, but I want to achieve a delay on the "mouseleave". The code looks like this: jQuery( function() { var targets = jQuery( '[rel~=...
V1pr's user avatar
  • 171
2 votes
1 answer
46 views

I'm making a generic abstract class that will work with float and integer values and will use different algorithms to generate a new value. It relies heavily on picking a random value within range, so ...
Aisaax's user avatar
  • 604
7 votes
1 answer
107 views

As explained in the docs, you can reference an existing function by prepending the & sigil: &say # reference to the `say` function &infix:<+> # reference to the infix `+` ...
uzluisf's user avatar
  • 3,185
3 votes
0 answers
118 views

From c++11 onwards, there are lvalue and rvalue references. I am aware of the differences between them. However, akin to function pointers such as int(*fptr)(), c++ also has lvalue and rvalue ...
LoquaciousLlama's user avatar
0 votes
1 answer
194 views

It is well known that you cannot create a reference to a member function in C++ [source]. For those that don't know. The issue come when you want to do something similar to class A { public: void ...
João Viana's user avatar
0 votes
1 answer
161 views

I have an issue similar to the one described in this post however mine involves a function being called in script 1 from a second script that stores the function. Essentially script1.R has reference ...
BLP92's user avatar
  • 345
2 votes
2 answers
396 views

I've been working with a doubly-threaded BST in C++, and I thought it would be cool to separate my visitor functions from my various traversals. However I can't figure out how to properly pass ...
ToTheStars_1138's user avatar
0 votes
2 answers
778 views

I have created a function that should get a suspended function as its parameter, run it, and perform some operations with the results. When I try to call this function and pass a function reference ...
ran8080's user avatar
  • 41
-1 votes
2 answers
209 views

i am making some callback system and i wonder if i can reserve function reference to unordered_map so that i can invoke it later. float func_imp(float x) { return x; } int main() { using Tumap ...
liiight's user avatar
  • 25
1 vote
1 answer
399 views

Edit: this question is based on two mistakes: not originally yincluding self in methods and assuming unbounded methods would not exhibit polymorphism, but they do. I voted to close it. I can take a ...
user118967's user avatar
  • 5,882
0 votes
2 answers
193 views

I have data frame like below Col1 Col2 White Orange White Blue Red White On executing the below code,the items from both columns adds together. Please explain how the function works ...
Bet's user avatar
  • 13
2 votes
1 answer
420 views

I am trying to bind a member function at or operator[] of std::array, but the compiler (gcc 7.3) says that it can't determine the typename _Func. So I had created my own struct array to see where the ...
Tom's user avatar
  • 23
0 votes
1 answer
294 views

I was wondering, whether it is better (in a way of having clean code according to a best practice) to pass function as reference using a new code block (lambda expression) or using a callable ...
Lukas Forst's user avatar
9 votes
1 answer
471 views

Is it possible to get a function reference to a function which has default parameters, specified as the parameterless call? InputStream.buffered() is an extension method which transforms an ...
Zymus's user avatar
  • 1,698
1 vote
1 answer
882 views

My program tui.py consists of about 70 functions, which are sorted groupwise into four different documents: tui.py tbt.py ens.py hmm.py. Most functions call at least one other function, some also call ...
muggi's user avatar
  • 323
2 votes
2 answers
262 views

In this code snippet how does new MyDel(this.WelcomeUser) work? What happens in memory, I know that delegate is reference type, so is there an object created in heap and which type of object is it - ...
Grigoryants Artem's user avatar
1 vote
1 answer
329 views

In the following code (in kotlin) fun greet(){ print("Hello! ") } fun salute(){ print("Have a nice day ") } fun main(args: Array<String>){ //val todoList: List<()->Unit> =...
KansaiRobot's user avatar
  • 10.6k
0 votes
5 answers
264 views

I keep on seeing: () => execute code instead of just execute code in callbacks. I am not passing in any parameters, so why does () => execute code work but execute code doesn't? Aren't they the ...
FranktheTank's user avatar
1 vote
1 answer
2k views

Having class member function like: private fun getData1(uuid:String): IData? { ... } private fun getData2(uuid:String): IData? { ... } private fun getData3(uuid:String): IData? { ... } ...
lannyf's user avatar
  • 11.1k
154 votes
1 answer
23k views

In Java we have the Class::new syntax for constructor references. I know, there are callable references for methods, but how about constructors? A typical use case for me would be factories.
Kirill Rakhman's user avatar