我有
auto result = std::is_convertible
< boost::optional<int>
, bool
>::value;
static_assert( result , "task should return bool" );
它无法编译。std::is_convertible的定义是
template< class From, class To > struct is_convertible;
并且 optional 显然可以转换为布尔值,因为我们总是像这样使用它
void(boost::optional<int> const & value){
if(value){
std::cerr << *value << endl;
}
}
我在这里想念什么?