迁移到VS2013 比较运算符报错C2678:binary '==' 没有运算符

Migrate to VS2013 Comparison operator Error C2678:binary '==' no operator

我的以下代码在 visual studio 2005 中运行良好。但是在迁移到 visual studio 2013 时出现编译错误。

// Check if the row in the file starts with a double value
bool RowReader::isDouble(std::wstring value)
{
    double testValue;
    std::wistringstream in(value);
    in.setf(std::ios::dec, std::ios::basefield);

    if((in >> testValue) == NULL)
        return false;

    return true;
}

错误是:

Error   1   error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::basic_istream<wchar_t,std::char_traits<wchar_t>>' (or there is no acceptable conversion)

有什么帮助吗?我对此很陌生。 1. testValue初始值是0吗? 2. 如果第一个字符不是 double,为什么它等于 NULL? 3.如何修复这个编译错误?

问题已解决。见以下代码:

bool isDouble(std::wstring value)
{
    wchar_t * endptr = 0;
    wcstod(value.c_str(), &endptr);
    if (*endptr != '[=10=]' || endptr == value.c_str()){
        return false;
    }
    return true;
}