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 » Trouble with reference variable in THISBACK1
Re: Trouble with reference variable in THISBACK1 [message #46802 is a reply to message #46784] Fri, 12 August 2016 08:33 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14256
Registered: November 2005
Ultimate Member
BEWARE: Pointers might compile, but do not work either!

Trouble is: Vector::Add invalidates existing references to elements. As the time when the 'job' is actually performed is undefined, it is likely that at that time the pointer is already invalid.

(Of course, with loop to 1, it works...)

Solution is either to SetCount before loop (if it is known) or to use Array.

Anyway, THISBACK1 indeed does not work with pointers. Solution is simple: Forget THISBACK1 and be modern, use MSC15, trunk U++ and C++11:

cw & [=] { prepare_c(cv.Add()); };

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Invalid build method (.bm).
Next Topic: Accept example in Tutorial
Goto Forum:
  


Current Time: Wed Apr 30 16:31:08 CEST 2025

Total time taken to generate the page: 0.02763 seconds