[optional] from_optional

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[optional] from_optional

Vaclav Vesely

There is common need of getting value from optional with possibility to
define default value in case of the optional is uninitialized. I suggest two

    optional<int> o;
    int i = o.get(123); // meber function get with additional parameter
    int j = from_optional(o, 123); // free function

Both alternatives can be implemented simultaneously.

What do you think about it?


Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost