Using C++17 std::optional—Bartlomiej Filipek

Save to:
Instapaper Pocket Readability

See how and when std::optional from C++17 is useful:<img alt="" data-cke-saved-src="https://dl.dropboxusercontent.com/s/nv9s71vz8kq8pq3/stdoptusing.png?dl=0" src="https://dl.dropboxusercontent.com/s/nv9s71vz8kq8pq3/stdoptusing.png?dl=0" 400px;="" height:="" 128px;="" float:="" right;"="" style="height: 74px; width: 230px; float: right;">

Using C++17 std::optional

by Bartlomiej Filipek

From the article:

By adding the boolean flag to other types, you can achieve a thing called “nullable types”. As mentioned, the flag is used to indicate whether the value is available or not. Such wrapper represents an object that might be empty in an expressive way (so not via comments smile)

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.