Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

tuple vector c++

#include <bits/stdc++.h>
using namespace std;
int main() {
    typedef vector< tuple<int, int, int> > my_tuple;
    my_tuple tl; 
    tl.push_back( tuple<int, int, int>(21,20,19) );
    for (my_tuple::const_iterator i = tl.begin(); i != tl.end(); ++i) {
        cout << get<0>(*i) << endl;
        cout << get<1>(*i) << endl;
        cout << get<2>(*i) << endl;
    }
    cout << get<0>(tl[0]) << endl;
    cout << get<1>(tl[0]) << endl;
    cout << get<2>(tl[0]) << endl;

    return 0;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #tuple #vector
ADD COMMENT
Topic
Name
2+8 =