Summary
Keywords
Full Transcript
►Full C++ Series Playlist: https://www.youtube.com/playlist?list=PLvv0ScY6vfd8j-tlhYVPYgiIyXduu6m-L ►Find full courses on: https://courses.mshah.io/ ►Join as Member to Support the channel: https://www.youtube.com/channel/UCA64pZbN5Mz5NxC3SO4qpDg/join ►Discussion Forum: https://forum.mshah.io/ ►Lesson Description: In this lesson we learn about std::optional a vocabulary type (like std::any or std::variant). std::optional is useful when you 'may' return a value. I tend to use std::optional if a 'try' is acceptable or part of the functional name -- that's usually a good hint. std::optional wraps the value or otherwise returns std::nullopt if a value is not present. I'll show you in this lesson how to otherwise use std::optional as a return type. We'll also explore the monadic operations to chain togetehr various operations and potentially clean up our code. Finally, consider that std::optional is a way to sort of 'lazily' initialize objects. As always, feel free to bring up any questions and discuss what you've learned! ►YouTube Channel: https://www.youtube.com/c/MikeShah ►Please like and subscribe to help the channel! ►Join our free community: https://courses.mshah.io/communities/Q29tbXVuaXR5LTI3MzAz
