Vector of array

i want to work with a vector of array but i get this error when i initialize it




vector<int [5]> ensemble_possibilite(1000);

error: conversion from 'int' to non-scalar type 'int [5]' requested


Thanks

Joel
closed account (zb0S216C)
You can do two things:

1) Create a vector of pointers-to-arrays, like so:
 
std::vector< int( * )[5] > Arrays;


2) Create a vector of pointers that allocate an array dynamically, as such:
1
2
3
std::vector< int * > Arrays;

Arrays.push_back( new int[5] );


Wazzak
Topic archived. No new replies allowed.