Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Array - insertsorted method

Author
Message
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 17th Dec 2017 17:31
Is is possible to get the index in which the 'insertsorted' method has inserted the new element?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Dec 2017 21:57 Edited at: 17th Dec 2017 21:59
i think only with find after inserted
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 18th Dec 2017 04:59 Edited at: 18th Dec 2017 05:00
Thanks Markus. I was not clear. I asked for other ways than this. It seems that there is no other way, but it could be like:



which is more efficient in many cases
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th Dec 2017 11:03
yes, but its not, yesterday i made a feature request for it.
i agree it make sense to return the index there.
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Dec 2017 14:21
Other option would be to make your own insert method that returns the index. Wouldn't really be much of a performance difference I bet since it's probably just a binary search.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-11-24 05:42:13
Your offset time is: 2024-11-24 05:42:13