Skip to main content

Timeline for How should one use std::optional?

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
Jun 3, 2017 at 14:15 comment added underscore_d @Wiz This is actually a great example. It (A) lets str2int() implement the conversion however it wants, (B) regardless of the method of obtaining the string s, and (C) conveys full meaning via the optional<int> instead of some stupid magic-number, bool/reference, or dynamic-allocation based way of doing it.
Oct 3, 2013 at 16:35 comment added Luis Machuca Because you can pass the information on whether you got an int or not up or down call hierarchy, instead of passing around some "phantom" value "assumed" to have a "error" meaning.
May 31, 2013 at 15:53 history edited taocp CC BY-SA 3.0
edited body
May 31, 2013 at 15:47 history undeleted taocp
May 31, 2013 at 15:46 history deleted taocp
May 31, 2013 at 15:42 history answered taocp CC BY-SA 3.0