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.

Dark GDK / Lists in C++

Author
Message
Slow Target
16
Years of Service
User Offline
Joined: 10th Jan 2008
Location:
Posted: 2nd Feb 2008 03:59
I'm a novice... how do I handle a list of list of things?

I want to have a "plan", which is essentially a list of coordinates and routes (which is a list of coordinates). Ideally, there'd be some data paired with the points (probably desiged speed, start time, ??? )

It will have to be dynamic as I won't know how big the list could get, and I want the user to be able to build the plan buy adding points and routes to the plan.

TIA,

John
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 2nd Feb 2008 04:20
Use a struct to make the coordinate data and use std::vector for the list of coords, so something like this:




To get each waypoint, use a for loop, and do Path[waypoint] to get the data. Of course, that will return a CoordXYZ type.



Your signature has been erased by a mod
Daggeth
17
Years of Service
User Offline
Joined: 3rd May 2007
Location:
Posted: 4th Feb 2008 06:58
Note: std::vector is just like an array, meaning you can access it using path[1], etc. Theres also a very good indepth tutorial on it in the MSN developer network dealy. Just search for "Vector Class Tutorial" under "Help->How do I?"

Login to post a reply

Server time is: 2024-11-20 01:40:19
Your offset time is: 2024-11-20 01:40:19