Top "Pass-by-value" questions

pass-by-value is a "one way passing" so that modifications of the passed value inside the receiving function (or other entity like process, etc) are not returned back.

Function Overloading Based on Value vs. Const Reference

Does declaring something like the following void foo(int x) { std::cout << "foo(int)" << std::endl; } …

c++ pass-by-reference pass-by-value overloading
C++ view types: pass by const& or by value?

This came up in a code review discussion recently, but without a satisfactory conclusion. The types in question are analogues …

c++ c++11 parameter-passing pass-by-reference pass-by-value
How to pass pointer to function and dynamically allocate memory within function C++

I'm trying to declare a pointer and pass that pointer to a function where memory is allocated. Here is a …

c++ pointers pass-by-reference pass-by-value function-definition
Confused by single pointer and double pointer arguments in function calls

I'm trying to get a deeper understanding on pointer arguments in functions for C. I've written a test program to …

c pointers pass-by-value pass-by-pointer
How to modify an array in function?

MATLAB is a pass by value language. I have a recursive function that processes pixel's neighbors. It is very expensive …

matlab pass-by-reference pass-by-value
template pass by value or const reference or...?

I can write a templated function this way template<class T> void f(T x) {…} or this way …

c++ templates pass-by-reference pass-by-value
Passing vector of vectors to function

I have a function which accepts a vector<vector<MyClass>> and modifies the MyClass instances. It's …

c++ vector pass-by-reference pass-by-value pass-by-pointer
What exactly is copy-on-modify semantics in R, and where is the canonical source?

Every once in a while I come across the notion that R has copy-on-modify semantics, for example in Hadley's devtools …

r pass-by-reference pass-by-value
Passing inline double array as method argument

Consider method functionA (double[] arg) I want to pass a double array inline, like functionA({1.9,2.8}) and not create an array …

c++ arrays pass-by-value function-parameter
Const correctness for value parameters

I know there are few question about const correctness where it is stated that the declaration of a function and …

c++ pass-by-value const-correctness