Timeline for Is there a use for non-const reference parameters?
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 10 at 23:35 | comment | added | xealits |
just to add to the answers, often when you want to modify a parameter, the actual intention is to have a return parameter. In that case, a typical practice is to use a pointer to non-const, not reference. It's a nice convention, and it also gives you an option of passing nullptr then. When it is a purely input parameter, you always use const reference or copy by value. Also, Core Guidlines have more suggestions. They do recommend references for "in and out parameters".
|
|
| Nov 22, 2018 at 9:30 | review | Close votes | |||
| Nov 27, 2018 at 3:05 | |||||
| Nov 22, 2018 at 9:11 | history | protected | gnat | ||
| Nov 21, 2018 at 22:31 | answer | added | xaviersjs | timeline score: 0 | |
| May 15, 2015 at 13:22 | vote | accept | user2738698 | ||
| May 14, 2015 at 21:45 | answer | added | Mike Nakis | timeline score: 4 | |
| May 14, 2015 at 20:38 | review | Close votes | |||
| May 21, 2015 at 10:41 | |||||
| May 14, 2015 at 20:22 | answer | added | user22815 | timeline score: 13 | |
| May 14, 2015 at 20:19 | answer | added | Robert Harvey | timeline score: 7 | |
| May 14, 2015 at 20:19 | comment | added | Lawrence Aiello | It depends on what you're doing. | |
| May 14, 2015 at 20:15 | comment | added | 5gon12eder |
Consider std::getline or std::swap.
|
|
| May 14, 2015 at 20:12 | history | asked | user2738698 | CC BY-SA 3.0 |