On python I can group arguments into a tuple, something like
def func((a, b, c, d), x):
print a, b, c, d, x
I was wondering if it is possible to group arguments in the same way on C++, something like:
void func((int a, int b, int c, int d), float x)
{
cout << a << b << c << d << x << endl;
};
1
it can be done with std::tuple
#include <iostream>
#include <tuple>
using namespace std;
void func(tuple<int, int, int, int> tup, float x)
{
int a, b, c, d;
tie(a, b, c, d) = tup;
cout << a << b << c << d << x << endl;
}
int main() {
func(make_tuple(1, 2, 3, 4), 5.5f);
return 0;
}
1