just to clear this doubt of fine i just want to ask that which method is faster or more efficient to access pairs while iterating over a contiguous block of pairs.
I used two method to iterate over a block.
1st
pair<int, char> arr[3] = {{1, 'a'}, {2, 'b'}, {3, 'c'}};
for (int i = 0; i < 3;i++){
cout << get<0>(arr[i]) << " " << get<1>(arr[i]) << endl;
}
2nd
for(const auto &x:arr){
cout << x.first << " " << x.second << endl;
get<0>(arr[0]);
}
which one is better and more efficient pls explain if u can.