U++ framework
Do not panic. Ask here before giving up.

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: 14291
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: Thu Sep 24 19:28:00 GMT+2 2026

Total time taken to generate the page: 0.02456 seconds