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,281
questions
3
votes
3
answers
124
views
Within the context of the code below, why is "cout << c" legal while "c = "x"" illegal?
I'm new to C++ and is trying to learn the concept of keyword 'auto' and reference. I saw this question and answer online.
Is the following range for legal? If so, what is the type of c?
const ...
1
vote
2
answers
8k
views
MS Excel: How do I make cell references variable?
I probably didn't word that title correctly, so let me explain what I'm trying to do.
I need to find cycles in a series of data. So let’s say I have all of my data in column A of an Excel ...
0
votes
1
answer
34
views
R Reference Class Add New Variable by Name
Consider the following R code :
MyClass <- setRefClass("MyClass",
fields = list(
),
methods = list(
initialize = function(x){
#give new attribute x
...
82
votes
9
answers
219k
views
What's the difference between primitive and reference types?
This is a past exam question and I was wondering what a primitive type and reference type are first off?
With an array I know that a reference type is where the array is composed of objects or ...
3
votes
1
answer
59
views
What is the rationale for the expression class{}.refmem to be an lvalue expression
I came to know that S{}.rval is an lvalue expression. I want to know the rationale behind considering it an lvalue expression.
Why are access to non-static member of reference type lvalue, even when ...
2
votes
3
answers
6k
views
How to get multiple mutable references to elements in a Vec?
I have a large nested data structure and would like to pluck out a few parts to pass around for processing. Ultimately I want to send sections to multiple threads to update but I'd like to get my feet ...
-1
votes
0
answers
37
views
Lifetime of Temporary Passed to Multiple Functions by Const Reference in the Same Lexical Expression [duplicate]
According to the answers to this question, a temporary created in an expression lasts for the entire expression. This seems to imply that we can pass a temporary into and return it from functions by ...
5
votes
2
answers
158
views
Python object creation behavior
Coming from Java, I have trouble understanding how objects are allocated in Python.
Consider this Python script:
x = ("a", "b")
y = ("a", "b")
print(x is y) # ...
109
votes
7
answers
130k
views
Visual Studio: Relative Assembly References Paths
When adding a reference to an assembly located within the solution directory, is there any way to add it relatively, so that when checked in and out of a repository it is referenced in projects ...
6
votes
0
answers
177
views
Why adding a type annotation eliminates the borrow error? [duplicate]
I was learning Rust and all the references and borrowing stuff when I came across this weird case:
fn main() {
let mut n = 42u32;
let ref1 = &mut n;
let ref2 = ref1; // line 5
...
0
votes
1
answer
15
views
Modify the values in a (global) list of dictionary without reference
I'm new to python - being an educator trying to write to python script to score student's performance downloaded from an online polling platform. I've solved most problems until something like this: I'...
1
vote
1
answer
124
views
Is it possible to initialize a struct reference with an array?
Is it possible to do something like this?:
struct S {
int length;
char data[100];
};
class C {
uint8_t buffer[10];
S& s = buffer[0];
};
If I use pointer it compiles, but working with ...
0
votes
0
answers
63
views
Confusion regarding addresses and references in C++. What are the data types of addresses and references respectively? [duplicate]
I understood that the & operator is context dependent,
int var = 5;
int* ptr = &var;
In the above code, &var returns the address of var, then gives it to the pointer.
On the other hand
...
1
vote
1
answer
53
views
Data validation reference provides value and not associated list values - VBA Reference Errors
It seems I'm running into a relative reference problem with the INDIRECT formula in the data validation section of my code.
I am trying to create a macro that will automatically update and format ...
0
votes
0
answers
9
views
Visual Studio Code - code reference break if I use path.join to specify imports (nodejs) [duplicate]
I am trying a more centralized way of specifying the import paths in nodejs, by using core path module.
Problem is that when changing from code A to code B specified below, Visual Studio Code stops ...