我尝试使用 boost::optional 返回简单数组
boost::optional<const char *> foo () {
char ar[100] = {};
return boost::make_optional(true, ar);
}
我收到以下错误:
could not convert ‘boost::make_optional(bool, const T&) [with T = char [100]](ar)’ from ‘boost::optional<char [100]>’ to ‘boost::optional<const char*>’ return boost::make_optional(true, ar);
我该如何处理这种混乱?