Skip to content

Files

Latest commit

Sep 29, 2024
6724c74 · Sep 29, 2024

History

History
This branch is 20 commits behind hsf-training/cpluspluscourse:master.

optional

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jun 22, 2023
Jun 22, 2023
Sep 29, 2024
Jun 22, 2023
Sep 29, 2024

Optional

Here we explore:

  • how std::optional offers an alternative to errors codes and exceptions.
  • how the insertion of a std::optional affects following functions.

Prerequisites

  • slides about std::optional

Instructions

In the file optional.cpp, modify the function mysqrt below so that it returns an std::optional<double> rather than a double, and the program prints nothing rather than nan for the call with -10. It will also require to modify square.