passing-variable-number-of-arguments-with-different-type
-
I like to enhance or make life complicated - depending on your point of view.
Up front - so there is no (usual) derailing the post - I am not interested in discussing why such and such way is not recommend.
Here is my starting point - RTFM.
For those who work better with exxamples - this is what I am trying to replace
int ScanAllLocal(QTextEdit*, QListWidget*, QListWidget* );
I like to start with multiple parameter of SAME type something like
int ScanAllLocal( QListWidget*... QListWidget* );
I understand that the key is using ellipsis (....) , but obviously that is not enough.
-
The answer is already in that SO thread, but the short version is
template <class... Args> int ScanAllLocal(Args... args)
It doesn't matter if parameters are same or different type.
-
@Chris-Kawa said in passing-variable-number-of-arguments-with-different-type:
It doesn't matter if parameters are same or different type.
And then you'd SFINAE-out incompatible types and you're going to hate your life for even starting on that path ... sigh, it's just how life goes ... ;)
-
@kshegunov said in passing-variable-number-of-arguments-with-different-type:
And then you'd SFINAE-out incompatible types and you're going to hate your life for even starting on that path
Well yeah, the entire idea is terrible, but OP explicitly said not to discuss that, so I didn't ;)