Questions tagged [reference]
A reference is a value that enables a program to indirectly access a particular datum, such as a variable or a record, in the computer's memory or in some other storage device.
reference
17,282
questions
0
votes
0
answers
35
views
Using Forms, how to call sub classes from an eventclass
I have several forms and several TextBoxes in each form. To isolate the code I use a class CCtrlTextBoxEvent
enabling events: Public WithEvents txtbox As MSForms.TextBox and i get callbacks on ...
2
votes
1
answer
94
views
Capture bit-fields by reference in a lambda expression
According to cppreference, bit-fields can only be captured by copy: https://en.cppreference.com/w/cpp/language/lambda. Period.
At the same time, one can see certain scenarios, e.g.:
struct U {
int ...
0
votes
1
answer
24
views
Why could I be experiencing an unresolved reference error in Python? [closed]
Unresolved reference error with the code below; I've included all the references in the same file, however, I'm still getting an error
class sample:
@staticmethod
def some_method():
print(&...
0
votes
0
answers
17
views
C++Linker: Unused classes/ functions
I am working with a couple of projects that rely on class libraries. A class (of course) might use other classes that might be present or not. This is handled by the linker in ansensible way.
...
0
votes
1
answer
66
views
std::vector not initialized in initializer list when using reference member [duplicate]
I'm trying to initialize the values vector with 25 values of 3 (for example) using the following code:
#include <vector>
#include <iostream>
class VecClass {
public:
VecClass(int v)
...
2
votes
1
answer
110
views
C# .NET : is "lock" required around ImmutableList reference copy?
A debate formed about a lock statement in our team - I would appreciate some external feedback about this.
The code part in question is:
lock (IndexLock)
{
currentIndex = Index;
}
You can see ...
1
vote
1
answer
33
views
inconsistency between compilers when getting a `constinit` reference on a template parameter object
In a previous post I discussed a technic to create static values from non-type template parameters.
In this post and its accepted answer, a code was given to achieve this goal but it fails to compile ...
0
votes
1
answer
19
views
Why does passing by reference change the answer while producing unique subsets?
Here is a solution to a problem to generate unique subsets of an array nums:
#include <bits/stdc++.h>
using namespace std;
void solveRec(vector<int> ss, set<vector<int>> &...
0
votes
0
answers
30
views
Why do the addresses of my variables not change after function is done processing in my assembly (HLA) program?
I'm trying to change the addresses of the variables once the procedure is done processing the instructions. I have no clue what I'm doing wrong and how to fix it. For example when I input
Gimme X: 12
...
1
vote
4
answers
178
views
Is passing a reference to a primitive from C++ to C context undefined behaviour?
I'm wondering about the behaviour of passing references of an int or float from C++ to C. So the called function expects an int, but I call with an int& Is this defined?
The compiler will ...
0
votes
1
answer
101
views
Can't understand why copy constructor gets invoked
The following should be a MRE:
#include <iostream>
class Vector {
public:
double x, y, z;
// Default constructor
Vector() : x(0), y(0), z(0) {
std::cout << "...
0
votes
2
answers
99
views
What is the difference between &mut Foo and *mut Foo? [duplicate]
In my Rust program, I'm getting back values of the form *mut Foo from a function written in C.
let x: *mut Foo = my_ffi_function();
What does this "*mut" notation even mean?
As far as I can ...
0
votes
0
answers
18
views
Dereferencing with mongoengine
I have an AuctionDocument which reference an ItemDocument.
I want to be able to query all auctions for a selleruuid, and iterate over the results (and have access to Auction.item.auctioned for ...
4
votes
1
answer
166
views
Const-correctness of std::reference_wrapper
A const std::reference_wrapper works similar to a reference, or a T* const (demo):
#include <functional>
struct S {
void operator()() { i++; }
int i = 0;
};
int main() {
S s;
...
-1
votes
1
answer
68
views
MobX State Tree: get a list of references that are using specific identifier
Well, the question is quite straight-forward.
Assume we have some model with identifier
const ReferableModel = types.model({
id: types.identifier(),
})
and an indefinite number of models that can ...