char vector

let say

char temp[8][8];

and you want to make vector of this char

vector<????> boardVec;
You can have nested vectors as well: std::vector<std::vector<char>>.
However, nested vectors can have bad performance. It's usually better practice (when trying to represent a grid) to have a one-dimensional vector with size equal to the area of the grid, then you can address individual coordinates by the the offset x+y*width
Last edited on
std::vector<std::vector<char>> temp

http://www.cplusplus.com/reference/vector/vector/vector/

Or since you are dealing with fixed sized arrays:
1
2
3
4
const unsigned board_size(8);
std::array<std::array<char,board_size>,board_size> temp;
//Or the more clean looking and probably easier to work with:
std::array<char,board_size*board_size> temp;


http://www.cplusplus.com/reference/array/array/?kw=array
Topic archived. No new replies allowed.