Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Add include suggests wrong header
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jschroedl
Tomato Guru

USA
103 Posts

Posted - Feb 15 2013 :  6:53:10 PM  Show Profile  Reply with Quote
The refactoring for std::function<> offers to #include <memory> but should offer to #include <functional>.

It's interesting that if I use Goto Implementation, I am correctly taken to <functional>



Info:
VS 2012 Premium with Update 1.
VAX VA_X.dll file version 10.7.1925.0 built 2012.12.14

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Feb 18 2013 :  8:12:22 PM  Show Profile  Reply with Quote
This is because it does matter if you use Add Include (or Goto) on "std" or on "function". What happens if you use "Add Include" on the "function" part?
Go to Top of Page

jschroedl
Tomato Guru

USA
103 Posts

Posted - Feb 19 2013 :  6:41:15 PM  Show Profile  Reply with Quote
Indeed, if I use Add Include on the function part, it suggests <functional>. So, I'd say the bug is the suggestion to add an include for <memory>. Why would it suggest that instead of functional or nothing at all? I read the type as std::function<>.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Feb 20 2013 :  3:58:15 PM  Show Profile  Reply with Quote
std is a namespace which is defined in several places, including <memory>. When more than one declaration file is available, VA picks one of them, maybe the first one.

I see how it can be strange from the point of view of the user, though.
When you refer to a symbol through a "chain" of symbols, it might be possible that you want to include more than one file. An example of this would be the following:

You have an object which is a pointer in a file and you refer to the class's method in an other file, something like the following:

file1.h:

extern cSomeClass* Obj;

file2.h:

class cSomeClass
{
    void Method1();
};

So if you write the following in somesource.cpp you will want to include both file1.h and file2.h:

Obj->Method1();

This can be done via using "Add Include" first over "Obj", and then over "Method1".
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000