Timeline for NamedPoint class using unique_ptr for members
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 21, 2016 at 5:09 | vote | accept | shtkuh | ||
Jul 20, 2016 at 13:18 | comment | added | forsvarir |
@shtkuh I don't have a problem with you returning raw pointers, I have a problem with the inconsistency of your interface. The goal of you using a unique_ptr is to simplify memory management within the class. Why should a client of the class be expected to facilitate that? It would be better to have your constructor and setName take in a const raw pointer and have the constructor create the unique_ptr that's used internally by the class. I should be able to call node.setName(othernode.getName()) .
|
|
Jul 20, 2016 at 12:58 | comment | added | shtkuh | Well, you are right that the better way is to use string instead if char*. Saved it just because of original request. Let's imagine it should be pointer of some PointProperties type. The another note about raw pointer as a return value: please see that | |
Jul 20, 2016 at 8:32 | history | answered | forsvarir | CC BY-SA 3.0 |