Archived

This topic is now archived and is closed to further replies.

Dovyman

enum?

Recommended Posts

Ok I have this class, cModelFactory, which is basically responsible for getting a list of filenames from a script and loading models from those filenames. The user must specify a "name" for each model in the script. So cModelFactory does its thing and I have a vector of models, thats all well and good. But how can I somehow enum them with the names the user provided? [edited by - Dovyman on January 28, 2003 7:33:15 PM]

Share this post


Link to post
Share on other sites
Well, first off, what would be the point? Unless of course you''re dynamically changing the code to match some odd code-builder app that you''re giving the user, in which case it''s just a matter of parsing. Otherwise, you''re never going to know what those enums are to put them in the code anyway.

If it''s a matter of wanting ID numbers for your model structs for things like testing ==, etc, then just make the ID number a requirement and add an ID member to your struct (along with the name, so you can always get the name from the ID number). Or count them as you load them in, if you don''t want to make an ID number a requirement.

-fel

Darn 500 errors.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
a stl map could suit your needs, but its not an optimal solution since it isnt as fast at accessing elements as a vector. it might be worth looking into though.

Share this post


Link to post
Share on other sites