Re: named array
- Posted by TheresNoTime Sep 03, 2013
- 2144 views
Then I would agree that I don't understand the point. I updated the code you posted:
skipped
All I did was replace the narr stuff with map stuff. Note that you can also nest maps, and store and retrieve the data with a single call. Is there a reason you can't simply store the information inside of maps?
Yes, two reasons: 1. It is senseless to store same keys two times. 2. I needn't side effects.
I would say that you're probably better off just coming up with a key, storing the person's structured data as a sequence in a map and using an enum to access the various parts:
enum CITIZEN_FIRST, CITIZEN_LAST, CITIZEN_INCOME enum SUPERHERO_FIRST, SUPERHERO_LAST, SUPERHERO_TASK
Matt
Add a few more types of people (BOSS, CRIMINAL, BEAUTY, ASSISTANT). Each of them has three HUNDREDS of properties. Most of the properties are common to all. You may be hard-working Chinese. I'm lazy Russian. I want to quickly write a program to get a drink of vodka and go ride on a tank drawn by bears.