I'm not sure if this is the right place to post this question. Please tell me if it is not.
I have met many ' Institutions ' Each unit has many attributes (all institutions have the same number of qualities) which are stored in the form of arrays (the same length) I would like to store ' entities in such a way that I can get each unit by name.
To do this I would probably like a map & lt; String, unit & gt;
to store each unit by name.
Now before this problem (to store multiple entities), I will assign one unit to map & lt; String, vector & gt;
where each vector is a feature and the string attribute represents the name.
This will take into account Maps & lt; String, unit & gt;
A simple and elegant solution has already become odd to read and use.
-
Map as the NTP code & lt; String, vector & gt; Encapsashing seems like going very far for the sake of code (as I have no way of putting in the classroom).
Would it be better to use the unit as a straight to "beautify" the code?
Or am I missing that much more simple or more beautiful solution?
Or this implementation is the best I can expect?
Note: I am dealing with a large data set. The map will have 1500-2000 units. Each unit will have 4-10 attributes, each attribute will have around 10000 value. Performance is a constraint
I suggest a
entity
class or structure anyway Want to give The reason is that your implementation can change over time (for examplemap
tomultimap & lt; string, T & gt;
, orunarmed_map
), and you can explain such changes by giving an entity a real API and obstacles on the path to process by other code Can be inserted. This will make both code and possible compiler error messages even easier to read.If you set the class / structure implementation in the header completely and in the words of
virtual
methods Stroustrup, C ++ is a "light intangible language language" Which is to be parsed as "language for light addiction", and it is a place where light obesity is appropriate.
Comments
Post a Comment