30,340 questions
-1
votes
0
answers
41
views
AWS - Connecting Lambda to an Elastic IP to receive data given vendor has IP whitelisting (without NAT gateway) [closed]
I'm working on a project where I make a call using my lambda function which sends a request to client and in return I get a downloadable file (this whole task will be executed only once every 24hrs), ...
4
votes
2
answers
140
views
Accessing constant variables from a lambda in Visual Studio 2026
I have a program that I would like to build in Visual Studio 2026, but struggle with the errors appearing.
One simplified piece of code is as follows:
void f(const void*) {}
int main() {
...
-2
votes
2
answers
142
views
Why does this function receive 2 positional variables when it is only given one? [closed]
In a recent script I wrote I use the keyboard module for hotkeys but I decided to store all arguments in an array where I would use a loop to call them all. When I attempted to use any hotkey I ...
2
votes
1
answer
135
views
C# expression tree, property convert string to int/long
I have an IQueryable expression:
... Where(x => Convert.ToInt64(x.string_param) > Convert.ToInt64(string_const)) ...
How to build this throught expression tree? Kind of:
var left = ...?
var ...
0
votes
0
answers
99
views
When using lambda expressions with bulk update APIs for EF Core, is the lambda expression evaluated in-memory, or on the DB-side?
I am using the Bulk Update APIs, part of EF Core like the ExecuteUpdateAsync() functions, to perform updates, and I am passing in a lambda for my valueExpression. I am wondering if the evaluation of ...
10
votes
1
answer
549
views
Why does a class inherited from lambda type lack conversion to function pointer in Visual C++?
If a lambda is capture-less, its closure type has conversion operator to function pointer. For example,
auto l = []{};
using F = decltype(+l); //pointer to function type
constexpr F p = l;
And if a ...
-1
votes
0
answers
58
views
Entity Framework unable to translate IComparable cast of DateTime in OrderBy
In an effort to simplify some of my code, I tried using a switch expression to create a selector for sorting on an EF Core 10 query:
Expression<Func<Foo, IComparable>> selector = sortField ...
6
votes
1
answer
151
views
MSVC accepts lambda with deleted parameterized ctor while GCC and Clang rejects
I wrote the following program that is accepted by MSVC, but is rejected by both GCC and CLANG. What is the standard compliant behavior?
Live Demo
struct C
{
C(int) = delete;
C(){};
};
decltype([b ...
18
votes
1
answer
1k
views
Evaluation order of lambda capture initializers
Consider the following program:
#include <iostream>
int f(int i) {
std::cout << i;
return i;
}
int main() {
[a=f(1), b=f(2)]{}();
}
It prints 12 (with all major c++ ...
5
votes
1
answer
153
views
Lambda with deducing this parameter of unrelated type [duplicate]
A colleague of mine showed me a program with explicit object parameter in a lambda function. The program is accepted by two compilers, but produces a strange result:
struct A {
int a = 2;
...
1
vote
1
answer
130
views
Is there a difference between 'eval' and sourcing a temporary file?
These two examples accomplish the same thing:
# using eval
var=hello
eval "some_func() { echo $var; }"
some_func # "hello"
# using source
var=hello
source <(echo "...
3
votes
1
answer
132
views
Accessing a lambda's parameter leads to "Assignment type mismatch: actual type is 'Unit', but 'String' was expected"
I'm trying to pass a click handler to a child function that sends a string back to the parent and updates a mutable value based on the string. I'm getting an error on the function:
Assignment type ...
0
votes
1
answer
74
views
Array FILTER/TRANSFORM lambda using index
Snowflake supports higher order functions like FILTER or TRANSFORM.
A lambda expression that defines the filter condition on each array element.
The lambda expression must have only one argument ...
4
votes
3
answers
361
views
Passing a local reference to a closure
Consider the code below:
for (T &t : some_vector_) {
futures.push_back(thread_pool.submit([&t] { t.do_something(); }));
}
On some iteration i, t is initialized to a reference to a vector ...
Advice
0
votes
2
replies
85
views
Method-body equivalent of lambda expression
Following is a part of the execution sequence when a middleware gets configured in ASP.NET Core -
// my code
app.Use(some middleware);
// class UseExtensions / namespace Microsoft.AspNetCore.Builder
...