2d stl array

Solutions on MaxInterview for 2d stl array by the best coders in the world

showing results for - "2d stl array"
Emanuele
22 May 2018
1/*
2std::array is 1-dimensional, there is no such thing as a 2-dimensional std::array.
3You would simply have to use an inner std::array as the element type of an outer 
4std::array, eg:
5*/
6#include <iostream>
7#include <array>
8
9int main(){
10  std::array<std::array<int,5>,4> myarray;
11  for (int i=0; i<5; i++){
12    for (int j=0; j<10; j++){
13      myarray[i].at(j) = j+1;    
14    }
15  }
16}
17
queries leading to this page
std array 2dstl array 2d2d stl array