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.

learn more… | top users | synonyms

2
votes
1answer
58 views

Templated double ended queue (deque) move semantics edge cases C++

My original deque implementation and efficiency question lacked move semantics. After ratchet freak provided an example of how to define them I decided to try adding them to my deque. The unit test + ...
0
votes
0answers
16 views

(follow up) StringRef v.2 - read only std::string like class similar to boost::string_ref and std::string_view

Idea behind the class is same as C++17 std::string_view, boost::string_ref or llvm::SrtingRef...
2
votes
1answer
99 views

Ensure that ICommand implementation properly uses weak references

I am building an implementation of System.Windows.Input.ICommand that is like the commonly used RelayCommand, but doesn't keep a ...
0
votes
0answers
94 views

Releasing references with server connection library

I work on a custom library (Co.line) to do HTTP requests in REST. I tried to think of reducing the memory usage by cancelling the thread background and destroying all references. It uses a ...
0
votes
0answers
159 views

Copy-on-write linked list with value semantics

I'm implementing a SinglyLinkedList struct that uses a private Node class in its implementation. (See this Gist.) ...
6
votes
3answers
139 views

View programming pattern in C++ without raw pointers

I'm trying to achieve, for lack of a better term, a "view" pattern in C++. It's probably most comparable to "views" in the Database world, where one can make a query, and then perhaps aggregate the ...
1
vote
1answer
36 views

Binary Search Tree insert while keeping track of parent for node to be added - iteration 2

Follow up question to Binary Search Tree insert while keeping track of parent for node to be added I am implementing a red black tree for fun and am wondering how I should modify my basic BST ...
1
vote
2answers
51 views

Binary Search Tree insert while keeping track of parent for node to be added

This question has a follow up question: Binary Search Tree insert while keeping track of parent for node to be added - iteration 2 I am implementing a red black tree for fun and am wondering how I ...
7
votes
2answers
868 views

Calculating the price of movie tickets based on multiple inputs

I have modularized my code and currently my "main" function is movieSalesReport(). I am coming from Python where you can have the functions return multiple values. ...
10
votes
3answers
1k views

“Suspicious comparison of integer references” while checking for a monotonically increasing sequence

I have the following code which iterates on an Integer[] and makes sure that the the values in the array are in ascending order and that there are no neighbouring ...
2
votes
1answer
1k views

StringRef - read only std::string like class similar to boost::string_ref

Idea behind the class is same as boost::string_ref or llvm::SrtingRef. StringRef is immutable and not-owning. I did not ...
7
votes
1answer
144 views

Displaying a video player to eligible users

I posted this on Stack Overflow, but it was suggested that I move it over to Code Review. I would like some feedback on the way I decided to clean up code from the in a .NET project that had ...
2
votes
0answers
458 views

Universal “call” function

I need a function call(f, args...) which calls the "function" f with the arguments args.... ...
2
votes
2answers
364 views

Writing a class for common block of code used in many other classes

In this I have written the setAnalyticsInfo() method. The code inside this is common to almost all other (30) classes, so I have created ...
1
vote
2answers
272 views

Deep reference and object passing

I'm curious if this is the right way of going about the issue: ...
4
votes
2answers
5k views

Passing parameters by reference [closed]

Wouldn't it be better to always pass parameters by reference to avoid creating unnecessary copies? ...
3
votes
4answers
157 views

Reference type and constructors [closed]

Code in Java but should be readable also for c#... Let's assume I have a class with some reference types. Example: ...
3
votes
2answers
758 views

Am I using C++ pointers and references correctly?

I am a newbie to C++ programming and am currently reading this book called Jumping to C++ by Alex Allain. I have finished the pointers chapter and I am doing the exercises at the end of the chapter. ...