There is an application in which, when deviations from some parameters occur, it is necessary to report (call the method) to the special module the place where the deviation occurred and the values of some variables. The number and types of these variables is not known in advance and varies from case to case. There are many different cases. The question is, is there any container in std or boost through which you can pass an arbitrary number of elements of an arbitrary type to a function?
def Foo(container): for c in container: print(c) A = ["Text", 14, 99.0004] Foo (A) Wrote an example in python. I need to do something like this in C ++, preferably not having a garden again.
Foo(...)and pass on what you want :) - HarryFoo(...)does not allow to transmit anything at all. Functions with a variable number of parameters should not be used at all , since they are not type safe. And if you want to transfer anything in any quantities, usevector<boost::any>. But in the context of such a question, it is frankly unclear why you need C ++ at all if you are trying to cram dynamic typing. - VTT