Zomg, a project forklol.
Here's a question: what's the difference between these:
andCode:void a(std::string x) {}
?Code:void a(std::string& x) {}
Or do these apply only when I have const before ?
This is a discussion on By Value and By Reference within the C++ Programming forums, part of the General Programming Boards category; Zomg, a project fork lol. Here's a question: what's the difference between these: Code: void a(std::string x) {} and Code: ...
Zomg, a project forklol.
Here's a question: what's the difference between these:
andCode:void a(std::string x) {}
?Code:void a(std::string& x) {}
Or do these apply only when I have const before ?
Passing by value means a copy is made. Passing by reference does not involve copying. You could read this FAQ on references.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
another thing is that the second version is able to change the string x references