[LC++][OT] Which structure to choose

Julien Claassen julien at c-lab.de
Mon Feb 19 03:46:09 UTC 2007

Hi all!
  I'm still working on a console-based UI-library and I wonder in which 
structure to store my screen-objects. Each object derives from a common base.
  I want to be able to do the following:
  1. Probably search through all elements for a given word or whatever.
  2. move down/up left/right. So If i'm in row 1/column 13 and press cursor 
down, the cursor is positioned on the element, which is placed in row 2/column 
  Any good idea, an example, where someone had to solve a similar problem?
  Here are a few of my own first thoughts:
1. Take a vector of vectors. The first "Big Vector" represents the list of 
rows. The second "Small vector" represent one row. The vectors could be 
allocated statically at program startup. So the system tell me 25 rows/80 
columns I tell the first vector to reserve space for 25 elements and the 
second for 80 elements. I wonder if this is good practise, for it's a bit of a 
memory waste.
  2. Take something like a map and associate rows with columns.
  Any comments on that?
  Kindest regards

Music was my first love and it will be my last (John Miles)

======== FIND MY WEB-PROJECT AT: ========
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======

More information about the tuxCPProgramming mailing list