Skip to content

Commit

Permalink
fix compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
treefrogframework committed Apr 14, 2024
1 parent e6461ae commit ff013c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/optional.cpp
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <iostream>
#include <optional>
#include <string>

std::optional<int> get_even_number(bool get)
{
Expand All @@ -10,7 +11,7 @@ std::optional<int> get_even_number(bool get)
int main()
{
auto num = get_even_number(false);
std::cout << "Number is " << (num ? std::to_string(*num) : "not present") << std::endl;
std::cout << "Number is " << (num ? std::to_string(num.value()) : "not present") << std::endl;
return 0;
}

0 comments on commit ff013c7

Please sign in to comment.