Timeline for Null Object Pattern for STL Types
Current License: CC BY-SA 3.0
2 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 25, 2013 at 16:31 | comment | added | Abhijit |
+1: For introducing me to std::optional, and reminding me to use namespace. The first question is, why are you using pointers in the first place here? Just, to have a unified return irrespective of presence or absence of data.Pointers works well here. Various containers have their own error-code approach, but generally (ex. for sequences) I would have to end up returning iterators, and may not always be valid outside the context (as in my example). Unless std::optional was there in the stdlib, I don't see extra mileage in using it from what I have now.
|
|
Sep 25, 2013 at 16:13 | history | answered | Yuushi | CC BY-SA 3.0 |