#include <iostream>
#include <optional>
std::optional<int> add(int f, std::optional<int> s = std::nullopt) {
if (s.has_value() && *s != 0)
return f + *s;
else
std::cout << "no value\n";
return std::nullopt;
}
int main() {
std::optional<int> one = add(1);
if (one.has_value())
std::cout << *one;
}
why do i have to dereference the std::optional<int> like a pointer? whys it a reference. i want to know it deeper like what the computer is doing or smth idk