Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VAX fails to parse std::map std::pair

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
khumash Posted - May 17 2012 : 11:56:26 PM
VAX + VS2005 SP1

It seems VAX cannot correctly resolve std::map or std::pair first/second in my project. So codes like "itr->first->getFoo()" or "itr->second->anotherMethod()" all fail to display tooptip or intellisense when mouse over "first", "second", "getFoo()", "anotherMethod()". As for intellisense, when typing "itr->first->", the listbox won't show suggested methods.

I've rebuilt the VAX database but still no luck. What could be wrong with this? Thanks.
15   L A T E S T    R E P L I E S    (Newest First)
khumash Posted - May 29 2012 : 10:13:11 AM
That's fine, thanks.
feline Posted - May 29 2012 : 09:23:23 AM
If you want to try and get this working in VS2005 I am happy to work with you to try and find the problem.

It is certainly true that the IDE intellisense parser has improved since VS2005, it is a lot better in VS2010.
khumash Posted - May 28 2012 : 10:26:27 PM
Yes. Most of time, I can edit in VS2010 which provides the correct intellisense, and only build/debug in VS2005. Thanks again.

PS. it seems VS2005 intellisense parser is buggy as this is not the first project having this issue. I remember several years ago, I had similar member resolving issue several years ago.
feline Posted - May 28 2012 : 4:15:30 PM
In VS2010 VA no longer underlines mistyped symbols in C++ code, the underlining comes from the IDE. So it sounds like the IDE intellisense parser in VS2010 is handling this code correctly.

Is working in VS2010 an option for you? Or are you still doing a lot of work in VS2005?
khumash Posted - May 26 2012 : 11:53:57 AM
For the underline issue, it's mistyped symbols.

I tried to open the same solution in VS2010 and everything works great. No mistyped symbols, listbox shows correct members. So it must be a VS2005 only issue.

Thanks for all the help!
feline Posted - May 24 2012 : 1:44:17 PM
If you are working with a class member, can you please try making a new cpp file, and just adding a simple test function, and the single #include for the class you are using. No need to make this code compile, I am just looking to produce a fairly simple test case.

You can then try the problem code, and if this fails, try using the std::map and std::pair members from the class directly, bypassing the typedef's, and see if this works correctly.

There could be something in your solution that is confusing our parser. If this confusing code is further up the cpp file you are working in, then the test code should work here. If the problem is in the header file its self then copying just the class into a new test solution might give a useful test.

The other thing I would suggest is go into VA's options dialogs and set:

VA Options -> Advanced -> Underlines -> Underline spelling errors in comments and strings using
VA Options -> Advanced -> Underlines -> Underline mistyped symbols using

to two different, and quite distinct colours, perhaps green and purple. This way if you get any underlining you will know if it is coming from VA or from the IDE, and if VA thinks it is underlining a spelling error or a mistyped symbol.
khumash Posted - May 24 2012 : 03:15:10 AM
@feline, yea, the test code worked file for me as well. Is there any way to debug this to figure out the root causes? I am afraid trying more test code wouldn't help in this case since the problem might not be typedef, map, pair.

My VS project has all source code included, so I shouldn't need to include any other folders in "Additional Include Directories". I tried open the same project in Kdevelop and the problematic std::map or std::pair is resolved fine and shown correct listbox.

Thanks!
feline Posted - May 23 2012 : 1:32:57 PM
I am still not able to reproduce this problem. I have added the following code to my test function, which seems to be doing the same thing as your code. Can you try this code on your system please, and see if you get the same results:

	typedef std::pair<felineTestMapFirstSecond *, int> myPairFeline;
	typedef std::map<std::string, myPairFeline> InstMapFeline;
	InstMapFeline::iterator itViaInstMapFeline;
	// no underlining on this line
	itViaInstMapFeline->second;
	// typing "->" after "first" shows a listbox
	itViaInstMapFeline->first;

	myPairFeline &myPairInstance = itViaInstMapFeline->second;
	// note - using dot not "->" here, since "myPairInstance" is a reference, not a pointer
	// typing "->" after "first" shows a listbox of 2 items
	myPairInstance.first;

If you are not seeing any problems with this test code, would you be able to try and reproduce the problem you are seeing in a new, default project that you could then send to me? Or if possible post more complete code samples here, that I can test to see if I can reproduce the problem?
khumash Posted - May 22 2012 : 11:23:46 PM
@feline, yea, you are right. I meant that typedef is for an iterator. I tested your test case, it works fine. Instead of having you write more sample codes, let's take a look at my code.

typedef std::map<std::string, MyPair> InstMap;
typedef std::pair<myClass1*, int> myPair;

InstMap::iterator f = _instMap.find(instName); // _instMap is a private property in current class

MyPair& myPair = f->second; // issue 1: there's red curly line under "second". Same issue for f->first. I got lots of these kind of error in my project.
myPair->first-> // issue 2: type -> after first won't see a listbox with member functions in myClass1
accord Posted - May 22 2012 : 5:24:25 PM
Something went wrong with my test it seems, now I'm also getting the correct result in the basic case. Did I just dream it before?

I also get first and second with Feline's additional typedef code.
feline Posted - May 22 2012 : 5:14:50 PM
I am confused, a typedef helps you make a new variable, its a type, not an instance. Plus the typedef you have given here is not for an iterator. I have added the following code to the end of my "testGeneralCode" function, and as the comment explains, it is working as expected:

	typedef std::map<int, felineTestMapFirstSecond>::iterator MapFelineItTest;
	MapFelineItTest typeItTest;
	// type dot after "second" on this line, and a listbox appears
	// with the two members of "felineTestMapFirstSecond"
	typeItTest->second;

can you try the same test please. What do you see? Am I testing the right thing here?
khumash Posted - May 22 2012 : 03:52:34 AM
@feline, your code works fine on my system.

I also have this typedef:
typedef std::map<int, felineTestMapFirstSecond> MapFelineTest;

Thus, MapFelineTest->first. and MapFelineTest->second. fail to show listbox. However, when mouse over to MapFelineTest, the tooltip shows typedef info.
feline Posted - May 21 2012 : 2:01:15 PM
Are you using just "std::map", or something more complex? So far I am not seeing a problem with std::map, using VS2005 and VA 1905 I have added the following code to a header file:

struct felineTestMapFirstSecond
{
	int nMapStructOne;
	int nMapStructTwo;
};

and the following code to the matching cpp file:

static void testGeneralCode()
{
	std::map<int, felineTestMapFirstSecond> mapTestFirst;
	std::map<int, felineTestMapFirstSecond>::iterator mapIt;
	mapIt = mapTestFirst.begin();
	// type dot after "second" on this line, and a listbox appears
	// with the two members of "felineTestMapFirstSecond"
	mapIt->second;
}

As the comment says, this is producing the expected results for me. Can you try the same test code on your system please, and see what results you get?
khumash Posted - May 18 2012 : 9:50:12 PM
@accord, can you let me know the link to case 63909? Thanks.

I tried default Intellisense, but still got the same error. On the status bar, it shows a message "No additional information available".

Should I include some directory to the project properties so VS2005 or VAX knows where to parse the additional files? Although I think regarding to "itr->first->getFoo()", the source is in my project and there's no need to include from another place. Please advise, thanks.
accord Posted - May 18 2012 : 5:24:10 PM
I am seeing the same effect, thank you for the clear description.

case=63909

For now, can you please try turning on the following setting?

VA Options -> Advanced -> Listboxes -> Get content from default Intellisense

I tried doing that and it has helped for me.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000