代码有两个验证点:
1.tempWithNull 为空,boost::make_optional()之后验证out并不是boost::none。
2.dateToGet是boost::optional类型的,temp不是boost::optional类型的,可以直接赋值。
#include <iostream>
#include <boost/optional.hpp>
#include <vector>
using namespace std;
int main() {
std::vector<int> tempWithNull{
};
std::vector<int> temp