Why optional is my new favorite feature in C++

Поделиться
HTML-код
  • Опубликовано: 28 сен 2024
  • I recently came across the feature of optional in c++, and it is a feature I have liked so much, that I decided to make a video about it, as it allows me to write more clear and easy-to-understand functions.

Комментарии • 3

  • @jonathankiendrebeogo6523
    @jonathankiendrebeogo6523 4 дня назад

    great video, i learn a lot

  • @superboy9431
    @superboy9431 5 дней назад +1

    Optional doesnt replace result though, is there something in c++ that mimicls rust's result?

    • @MichaelForestTechnologies
      @MichaelForestTechnologies  5 дней назад +2

      That is true, as optional doesn't return an error type, only whether or not there is a value. To my knowledge, this is the closest I have seen so far, but I would not be suprised if there are even better solutions.