Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VA confused by iterating over map with shared_ptrs

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
muxecoid Posted - Jun 14 2020 : 10:42:50 AM
Given map with shared pointers:
typedef std::shared_ptr<Item> item_t;
typedef std::map<item_id_t, item_t> items_map_t;

And this code that iterates over it:

	for(items_map_t::const_iterator currItem = items_.cbegin(); currItem != items_.cend(); ++currItem)
	{
		currItem->second->doWork(args);
	}

VA can not determine that doWork refers to Item::doWork. "Goto Implementation" lists all symbols named doWork in current project. What is worse "Find References" on Item::doWork does not find the code above as reference. I use VA as main tool to learn a large codebase I inherited making this issue very annoying, can not trust VA for navigation.

Intellisense correctly identifies the symbol (but finding references is 10 times slower than VA).

VA_X.dll file version 10.9.2375.0 built 2020.05.09
DevEnv.exe version 14.0.25420.1 Professional
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jun 15 2020 : 08:14:57 AM
A random thought on this, in the file where you see this problem, does Alt-M (list of methods in the current file) and VA Outline report the correct information for the file?

If there is something in the file that is confusing our parser it will sometimes show up here as well, and also explain why Find References is getting confused. Checking at the file level can be an easier method of locating where the problem starts.
muxecoid Posted - Jun 15 2020 : 08:10:33 AM
I copied a snippet from production code and removed all proprietary information which could change something. I will play with separate test project to find minimal case where this reproduces.
accord Posted - Jun 14 2020 : 6:21:20 PM
I have completed your snippets to a code that complies. Find References on doWork works with that code. Did I complete your code correctly?

class testclass
{
public:
	void doWork() {}
};

typedef std::shared_ptr<testclass> item_t;
typedef std::map<int, item_t> items_map_t;

void func()
{
	items_map_t items_;
	for (items_map_t::const_iterator currItem = items_.cbegin(); currItem != items_.cend(); ++currItem)
	{
		currItem->second->doWork();
	}
}


Does find references work with my sample code?

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