In the past few weeks I've noticed a problem with the find references function. It was getting really unreliable and most of the times I had to do a simple text search to get all the references. So I took some time to investigate why that happened and came up with this little example:
#define USE_STD_SMART_POINTERS
namespace mystd
{
#ifdef USE_STD_SMART_POINTERS
using ::std::shared_ptr;
#else
using ::boost::shared_ptr;
#endif
}
namespace foo
{
class TestClass
{
public:
TestClass() {}
void Test() {}
};
class TestClassUser
{
public:
TestClassUser()
{
m_t.reset(new TestClass());
m_t->Test(); // not found
mystd::shared_ptr<TestClass> t2 = m_t;
t2->Test(); // also not found
mystd::shared_ptr<TestClass> t(new TestClass());
t->Test(); // found
}
private:
mystd::shared_ptr<TestClass> m_t;
};
}
Problem seems to be that there may be two possible implementations of shared_ptr. If I comment out one of them all references are found. I've tried using the va_stdafx.h file with a define for USE_STD_SMART_POINTERS but that didn't make any difference. Any idea how to fix this?
Tested in Visual Studio Professional 2013 (Update 4) with VAX 10.9.2052.