Problem with the operator & # 8594; overload in VS2010

I implemented a small C ++ framework that I use in the course I give in college to help students complete their homework. One of the most valuable classes of this structure is the class of smart pointers, which, as you can imagine, the operator is overloaded ->.

I recently upgraded from VS2008 to VS2010, and sometimes I get intellisense problems after entering the statement. Instead of showing the methods and fields available in the specified data type, it shows the methods and fields of the smart pointer class. Please note that this does not always happen, but once this happens, it is a little frustrating because I end up spending a lot of time.

Are you having such trouble? Any idea or suggestion to get around this will be greatly appreciated.

This may sound like a minor issue, but it cancels the use of VS2010 in the know until I can do it.

Thanks, advanced!

EDIT

I was able to reproduce the problem in a smaller context. Suppose I have something like this:

template <class T>
struct ptr
{
  T* operator->(){ return 0; }
  void otherMember() {}
};

template <class T>
struct node
{
  T value;
};

template <class T>
void foo()
{
  ptr<node<int>> pi;
  ptr<node<T>> pt;
  pi->value = 10; // OK, intellisense shows 'value'
  pt-> // wrong! intellisense shows 'operator->()' and 'otherMember()', instead of 'value'
}

Does anyone experience the same behavior?

+1
source share

Source: https://habr.com/ru/post/1775388/


All Articles