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.
45 questions
3
votes
1
answer
164
views
Reassignable reference_wrapper with empty state
I created a simple custom refernce_wrapper class template, which, in contrast to std::reference_wrapper, has some additional ...
4
votes
0
answers
83
views
A safe building block for self-referential structs in Rust, without macros
I recently had this (admittedly slightly crazy idea) on how to design a building block that can be used in safe Rust to build self-referential structs. Unlike gsrs or selfref it works completely ...
-3
votes
1
answer
92
views
Should a typecast to a unsigned long reference be used while calling a function or another unsigned long variable should be created? [closed]
I was working on a code base where I have a function definition like this:
...
1
vote
1
answer
58
views
Moveable Points - Update variable without Re-referencing variable? Event Subscriptions? (C#, Unity)
So I have this helper script that I use to move points around manually while debugging:
...
2
votes
2
answers
550
views
Slice function for C
I am trying to create a non-generic slice function. I want a 'view' not a copy.
The scan_from arg is so that successive calls ...
0
votes
1
answer
310
views
1
vote
1
answer
867
views
How to collect reference values from hashmap?
I have written a code snippet to use HashMap<String, Vec<&String>> as the main data structure, and finally, I want to return a collected ...
1
vote
1
answer
69
views
Dropping a row in a dataframe
I have made a function to drop a row in a pandas.DataFrame. Since, in general, the input dataframe of a function is just a reference to the dataframe. So any change made in that function to the ...
2
votes
1
answer
373
views
Handling Rc pointers correctly in a parent/children tree
Needs
A container holds two collections: Parent instances and Child instances; their items can be searched by name;
A child can ...
4
votes
1
answer
2k
views
C++ Optional Reference
Here is a good article on an optional reference type in C++. They discuss std::optional<T&>, but as that doesn't compile I have made my own.
One purpose ...
5
votes
0
answers
144
views
Production planner
I have a class that creates an object, PlannedYear, and then passes that object into several other classes to manipulate it. The ultimate goal of the class is to ...
2
votes
0
answers
132
views
Access a variable after several references
I have a team lead that used to write references in a single script then access it in every script. Like for accessing a variable he has to write code in this way ...
4
votes
2
answers
276
views
Music Theory: The Basics - a Ring
I've recently started building an API that allows a consumer to create and manipulate musical entities such as notes, intervals, scales and chords.
The first step is to create a a foundation of base ...
2
votes
0
answers
31
views
Modelling a program with modules, symbols, and dependencies
My scenario is the following: I'm modelling a Program which has many Modules. Each Module has Symbols, some of which pointing at dependencies, which are other Modules. So a Module can be pointed to by ...
4
votes
1
answer
285
views
Passing file identifiers to all subroutines of fortran code
The Fortran program 'MAIN' below calls 3 subroutines.
It opens a file if it is not present, (overwrites if it is already present).
writes something on the file using the file identifier integer and
...