|
|
|
|
|
by Panzerschrek
30 days ago
|
|
Putting loops inside virtual functions can't work in any cases. Like when a heterogenous collection is iterated and a virtual call is performed for each object. In such cases I prefer using std::variant instead of inheritance, but this works only if all possible types are known ahead of time. |
|
A vector of variants still wouldn't be optimal. Better to use something like
https://www.boost.org/doc/libs/latest/doc/html/poly_collecti...