我有一个看起来像这样的方法:
template <typename T>
T Test<T>::FindItem(T item)
{
if(found)
//return original value, no problem here
else
//I want to return NULL here, like:
return NULL;
}
Run Code Online (Sandbox Code Playgroud)
这在某些情况下在运行时失败,因为某些值在C++中无法转换为NULL,例如,std::string.我应该遵循什么方法?