Timeline for C++ API design: using references vs smart pointers in a getter API
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 24, 2019 at 22:02 | vote | accept | Marvg | ||
| Oct 6, 2019 at 0:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Sep 6, 2019 at 8:30 | comment | added | pschill | You need to think about ownership. Do you want the ViewManager to own the views? Then return references or pointers. Do you want to share ownership of the views across your classes? Then return shared pointers. Both can be valid cases that work in practice. Just ask yourself: Does it make sense to use a view after it has been removed from the view manager? If the answer is "no", then you dont need the shared pointer. From my experience, shared ownership can make the program flow pretty complicated, so I try to avoid it if possible. | |
| Sep 5, 2019 at 23:07 | answer | added | rwong | timeline score: 1 | |
| Sep 5, 2019 at 22:05 | review | First posts | |||
| Sep 5, 2019 at 22:31 | |||||
| Sep 5, 2019 at 22:03 | history | asked | Marvg | CC BY-SA 4.0 |