3 ms·
You cannot do anything meaningful with a container of arbitrary types, it's just bad design. If you want to apply the same operation on all of them, then they
by SuperV1234 6mo ago
You cannot do anything meaningful with a container of arbitrary types, it's just bad design.
If you want to apply the same operation on all of them, then they share some API commonality -- therefore you can use polymorphism or type erasure.
If they don't, you still need to know what types they are -- therefore you can use `std::variant`.
If they really are unrelated, why are you storing them together in the same container? Even then, it's trivial in C++: `std::vector<std::any>`.