简单类型 / 可空类型

#include <iostream>
using namespace std;

optional<int> n1 = 42;
bool exists1 = n1.has_value();
//exists1 is 1

optional<int> n2 = nullopt;
bool exists2= n2.has_value();
//exists2 is 0

cout << "exists1 is " << exists1 << endl;
cout << "exists2 is " << exists2;