Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » broken pick semantics
Re: broken pick semantics [message #37826 is a reply to message #37821] Thu, 15 November 2012 22:59 Go to previous messageGo to previous message
crydev is currently offline  crydev
Messages: 151
Registered: October 2012
Location: Netherlands
Experienced Member
I have read those topics and I understand how and why you did that. Though the information from those topics still couldn't help me find out my problem. I fixed it though! I created a reference to the global variable, and the error did not pop up anymore.

The problem didn't reside in the GetCount() in the above post as you said, the problem resided in my synchroniser:

void MovieSynchroniser::Synchronise(Vector<String> pDirectories)
{
	for (int i = 0; i < pDirectories.GetCount(); i++)
	{
		GetFiles(pDirectories[i]);
	}
}


This function was called using the global variable as parameter. I changed the function definition into:

void MovieSynchroniser::Synchronise(Vector<String>& pDirectories)


It makes sense to me though. Because I used a normal value object as parameter it already copied the contents of the vector, which using pick semantics, resulted in the original vector being empty. By using a reference pointer to the original vector, the pick assignment is not used, avoiding this problem. Am I correct?
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Thread with parametarized callback?
Next Topic: dropdown submenu into ToolBar
Goto Forum:
  


Current Time: Sun Aug 24 23:46:27 CEST 2025

Total time taken to generate the page: 0.05148 seconds