因此,这可能是我最近见过的最奇怪的事情,很好奇这种情况如何发生。编译器给了我一个错误,说当用作返回类型时,std :: String是不确定的,而当将作为类方法中的参数用作返回类型时!

#pragma once
#include <string>
#include <vector>

// forward declarations
class CLocalReference;
class CResultSetHandle;

class MyClass
{
public:
MyClass() {}
~MyClass {}

void Retrieve(const CLocalReference& id, CResultSetHandle& rsh, std::string& item); // this is fine
const std::string Retrieve(const CLocalReference& id, CResultSetHandle& rsh); // this fails with std::string is undefined?!?!
};

进行重建,一切仍然发生了,我必须选择干净的解决方案,然后在宇宙重新调整之后再次重建。虽然目前已经解决了,但我仍然想知道可能导致这件事是什么原因,因为我不知所措,为什么当没有冲突时,尤其是当我总是为STL使用完全合格的名称时。

有帮助吗?

解决方案

这可能是编译器错误。我在VS2010中看到了其他几个。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top