/****************************/ /* 可変個の引数 */ /* coded by Y.Suganuma */ /****************************/ #include <iostream> #include <map> #include <tuple> #include <string> using namespace std; void func(map<string, int> m, int p1, tuple<int, int> t, int p2) { cout << "p1: " << p1 << " p2: " << p2 << endl; cout << "t " << get<0>(t) << " " << get<1>(t) << endl; cout << "m"; for (auto x : m) cout << " " << x.first << " " << x.second; cout << endl; } int main() { tuple<int, int> t (100, 200); map<string, int> m {{"key1", -1}, {"key2", -2}}; func(m, 1, t, 5); return 0; }
p1: 1 p2: 5 t 100 200 m key1 -1 key2 -2