Skip to main content
The 2024 Developer Survey results are live! See the results

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
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 ...
温泽海's user avatar
  • 344
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 ...
Oersted's user avatar
  • 1,706
-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 ...
user985091's user avatar
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'...
Chris H's user avatar
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 ...
Anjonimus's user avatar
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 ...
Linton's user avatar
  • 7
0 votes
1 answer
40 views

The type or namespace name 'iOSBackgroundService' could not be found

Error Message : The type or namespace name 'iOSBackgroundService' could not be found I have created new class named iOSBackgroundService in Platform -> iOS. But I cannot inject it in the maui ...
Galaxylokka's user avatar
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 ...
Maple's user avatar
  • 251
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) # ...
Mohammad Javad's user avatar
0 votes
2 answers
97 views

Why this constant struct can be modified in this way?

Recently I encounter the following code, it is an excerpt from tutorial of open-source package AMReX text Array4<Real> const& a = fab1.array(); Dim3 lo = lbound(a); Dim3 hi = ubound(...
Xeh Deng's user avatar
0 votes
0 answers
74 views

JavaFX: setting list for comboBox does not work

I am working in a JavaFX project. There I have fxml included in other fxml files. Now I need to send data from the outer controller to the inner controller. I've tried it, but the combobox looses its ...
PalBeron's user avatar
-3 votes
0 answers
106 views

Are pointer variables sometimes faster to initialize than reference variables?

Let's say just for acquiring the MEMORY-ADDRESS and VALUE of some variable. If the variable is "nested" in pointers like so: int val = 10; int *ptr1 = &val; int *ptr2 = ptr1; int *ptr3 =...
ZenPyro's user avatar
  • 95
0 votes
1 answer
39 views

How to tweak font size and position of reference in quarto revealjs slide

This is my example code: --- title: "test" format: revealjs: footer: Institute of | Tarjae --- <!-- Style and format of footer --> <style> .reveal .footer { display: ...
TarJae's user avatar
  • 78.1k
0 votes
0 answers
46 views

Cannot find package 'aws-sdk' imported from /var/task/index.mjs

i am getting this error even after having the correct configuration using nodejs 18 { "errorType": "ReferenceError", "errorMessage": "require is not defined ...
software's user avatar
0 votes
0 answers
13 views

Error to find references in Visual Studio 2019

I noticed that every time I open a cloned project in a new environment (with Visual Studio 2019), the project cannot find the references it uses. I know that I can add the references again to solve ...
Thiago Moura's user avatar
0 votes
1 answer
84 views

How can I pass a reference to a closure in Rust?

I am using wry to spawn a few web views. Each view has a on_page_load_handler. Inside the handler I need to access the web view to e.g. navigate to another website. Sadly I fail to pass the web view ...
user3563584's user avatar
3 votes
1 answer
101 views

Why does `Option::map` work with immutable data, but not with mutable data

Why does the immutable version in the following example work, but the mutable version does not compile with error error: lifetime may not live long enough? trait Car { fn honk(&self); } ...
puaaaal's user avatar
  • 330
0 votes
0 answers
17 views

Suprema BioMini with C# - where should UFLicense.dat be put?

I'm developing a C# application using the BioMini SDK for fingerprint scanning. When running my application, I encountered the following error: Exception thrown: 'System.DllNotFoundException' in ...
khawulele Makopi's user avatar
0 votes
0 answers
78 views

"Unable to Create App State Field 'saveforlater' with Document Reference Data Type in Flutter Flow"

Story In my Flutter Flow project, I'm working on implementing an app with functionality similar to a shopping cart. I have successfully implemented the "Add to Cart" feature, but I am ...
KUNAL KUMAR's user avatar
0 votes
1 answer
78 views

Public static class and methods not found in NuGet package

I'm running into an odd issue where I've developed a NuGet package. Because of the architecture of the legacy software I'm trying to write new functionality for, this is in .NET Framework 4.6.1 (I ...
Steven's user avatar
  • 300
0 votes
0 answers
57 views

Why doesn't std::array<T,N>::operator[] return an rvalue reference for rvalue object? [duplicate]

std::array<T,N>::operator[] always returns an lvalue reference (const if needed), but what can possibly be the use of a line of code like this, which is valid C++? std::array<int,1>{1}[0] =...
Enlico's user avatar
  • 26.7k
1 vote
1 answer
50 views

A question on Rust trait/struct lifetime bounds coercion

I have recently stumbled upon a lifetime coercion issue that I am unable to resolve. The minimal reproducible example which I think stems from the same problem is the following: const MACGUFFIN: i32 = ...
Christoff van Zyl's user avatar
0 votes
0 answers
45 views

creating a cell reference with a fixed column name and the line # from a value in a different cell

I have a workbook with data from multiple years in separate worksheets. On my summary worksheet I am using the following formula, plus multiple similar formulas, to analyze data: =AVERAGE('2024:2014'!...
Howard Leibovitch's user avatar
6 votes
1 answer
95 views

Returning const reference from lambda stored as std::function segfaults [duplicate]

Here is the code: #include <vector> #include <functional> class TestClass { public: const std::vector<int> &getStuff() const { return callback(); } protected: ...
ligazetom's user avatar
  • 145
1 vote
2 answers
72 views

Powershell: How to copy, duplicate, or clone an object? [duplicate]

I'm banging my head against the wall. I have an issue where I'm dealing with objects created using the AWS Powershell Tools, specifically objects of type Amazon.Route53.Model.ResourceRecordSet and ...
Matthew McDonald's user avatar
0 votes
1 answer
100 views

Why does dereferencing a String (not &String) work in Rust?

In the following code, in calculate_length function we are sending String not &String, yet dereferencing works. I expected to get error something: type String cannot be dereferenced But the code ...
luffy's user avatar
  • 117
0 votes
0 answers
48 views

Why is it ok to return a reference to a function's default argument? [duplicate]

#include <iostream> //class for testing** class T { public: void print() { std::cout << "hello\n"; } ~T() { std::cout << "~T\n";} }; //function for ...
Kappy's user avatar
  • 27
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 ...
user23370984's user avatar
-1 votes
1 answer
65 views

What effect does the placement of the reference symbol (ampersand) have in a simple loop?

I just started learning rust and I am confused about how the ampersand placement affects the program in the following examples. I understand that '&' indicates a reference to a variable, but I'm ...
Nack's user avatar
  • 1
0 votes
0 answers
12 views

formula that will return the Company Account number for the invoice number

In the screen shot provided the company account numbers are in column B, the invoice numbers are in Column D. I need a formula that will return the Company identifier when the Invoice number is ...
Nikki Gordon's user avatar
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 ...
Jo-Helge Rorvik's user avatar
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 ...
Fedor's user avatar
  • 19.3k
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(&...
Th333w1's user avatar
  • 39
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. ...
AlexB's user avatar
  • 1
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) ...
Sedenion's user avatar
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 ...
David Molnar's user avatar
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 ...
Oersted's user avatar
  • 1,706
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>> &...
pkra2's user avatar
  • 3
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 ...
Hooray's user avatar
  • 3
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 ...
Gideon Geier's user avatar
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 << "...
lucottoDA's user avatar
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 ...
ccleve's user avatar
  • 15.6k
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 ...
lordslair's user avatar
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; ...
Dr. Gut's user avatar
  • 2,733
-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 ...
Limbo's user avatar
  • 2,200
0 votes
0 answers
11 views

How to reference an author in .bib

I have a .bib reference like this: @Report{wef2023, title = {Future of Jobs Report, 2023}, author = {World Economic Forum}, institution = {World Economic Forum}, address = {91-93 route de ...
Juan Riera's user avatar
0 votes
0 answers
56 views

Does optional<reference_wrapper> not return a reference?

I wanted to make a Table class that is supposed to work like a table with columns and rows, and values in the cells. Obviously I need a function that would allow to get the value from a particular ...
Marcin Pagórek's user avatar
0 votes
1 answer
34 views

Edit VBA to scan a document and pick out the reference numeral that corresponds to a string, e.g. output "102" for "dog 102" in the document

My current code to do this works when all instances of the string in the document are accompanied by the associated numeral. However, where some instances of "dog" arent followed by "...
cjrc's user avatar
  • 23
2 votes
1 answer
43 views

Do implicit and explicit transformations in C# affect real type transformations?

Why in the reference type, even if implicit conversion is done, the actual type conversion is not done even if explicit conversion is done? While studying explicit and implicit transformations, I was ...
JejuOrange's user avatar
0 votes
1 answer
43 views

Null referenced object created using Spring boot and Mongodb

I am a newbie using mongodb with springboot trying to create a simple collection with referenced object. Below are the JSON request and response(with null referenced objects). Please let me know how a ...
Srikar Sharma's user avatar

15 30 50 per page
1
2 3 4 5
346