1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| #include <iostream> #include <cmath> #include <string> #include <set> #include <algorithm> #include <tuple> #include <vector>
using namespace std; tuple<int, string, vector<int>> mtuple() { vector<int> a{ 5,1 }; return make_tuple (2,"test2",a); }
struct S { int n; std::string s; float d; bool operator<(const S& rhs) const { return std::tie(n, s, d) < std::tie(rhs.n, rhs.s, rhs.d); } }; int main() { tuple<int, string, vector<int>> test; vector<int> a{ 1, 2, 3, 4, 5 }; test = make_tuple(1, "hello", a); tuple<int, string, vector<int>> test1(1,"test",a); cout << get<0>(test1) << " "<<get<1>(test1) ; set<int> b; std::set<int>::iterator iter; bool inserted; tie(iter, inserted)=b.insert(3);
}
|