Timeline for Advanced String Calculator in C++
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 13 at 10:37 | comment | added | MrBean Bremen |
The result is just a double. Make it an optional instance variable (optional<double> result ), and check if it is already set in get_result .
|
|
May 13 at 10:10 | comment | added | JimmyHu | > Also, by "lazy calculation" I didn't mean to calculate the result each time it is accessed, but just once and cache the result. How can I cache the result and make the calculation just once? | |
May 13 at 6:47 | history | edited | JimmyHu | CC BY-SA 4.0 |
Update contents
|
May 11 at 14:44 | history | edited | MrBean Bremen | CC BY-SA 4.0 |
deleted 18 characters in body
|
May 11 at 14:07 | vote | accept | JimmyHu | ||
May 10 at 18:24 | comment | added | MrBean Bremen | I put more explanations into the answer. | |
May 10 at 18:24 | history | edited | MrBean Bremen | CC BY-SA 4.0 |
More explanation
|
May 10 at 15:14 | history | edited | MrBean Bremen | CC BY-SA 4.0 |
Answer to comment
|
May 10 at 14:51 | comment | added | JimmyHu |
Thank you for answering. > These same if constructs also have the same redundant code (reduce_operators(index) ), which can be factored out. This is not true, reduce_operators(index) should be placed after the computation and before the early return clause.
|
|
May 9 at 19:56 | history | answered | MrBean Bremen | CC BY-SA 4.0 |