I want to find a way to effectively track many objects at once. One practical example that I can imagine is a particle system. How are hundreds of particles tracked? I think I'm on the right track, I found the term "instancing" and I also learned about flytraps. Hopefully someone can shed some light on this and share some tricks with me. Thank.
How to track objects very much depends on what you want to do with them. Do you need to quickly access some particles known by index? Then use vector. Are your particles somehow mapped by names? Then you can use map. And so on and so forth.
vector
map
Hundreds of objects, of course, should not worry about C ++ unless you have chosen a particularly poor data structure. Why are you worried? Do you think you will lose too much memory? Or maybe a slow time? In any case, you must accurately describe the objects involved and the operations they need, and then select the appropriate data structure.
You cannot process them without missing them.
( ). , , , .
- , . , , , , - ( , , ).
.
. , .
- , -, , -, , , ( , , ). , , . , , . , , - , .
. . , Boost intrusive container.
, , , .
- .
- . . , , , .., , .
, . - . / . , , , . , , , , .
, .
"" , -.
"" , ( ).
On the GameProgrammingPatterns website, take a look at the object pool template . It is very well written.
From the article:Improving performance and memory usage by reusing objects from a fixed pool instead of allocating and freeing them individually.
Source: https://habr.com/ru/post/1737931/More articles:Qt: the default value of a variable in a class - c ++Qt plugins do not work - pluginsSelf-modifying classpath in Scala script? - linuxsearch XML documents using php - domPrims vs Polys: what are the pros and cons of each? - geometryGood way to do animations with Cocos2D? - performanceUsing Linq to filter ComboBox.DataSource? - c #How to configure SQL LIKE function? - sqlNewbie question: creating a custom control - asp.netParsing a 2-dimensional JSON array in Javascript - jsonAll Articles