I've been sitting here for a few hours now, trying to figure out how an array can be initialized with specified array[index]
, no not 0-n
, but n-N
, meaning that index can be: 3, and then it increments to N.
int array[];
std::iota(std::begin(array), std::end(array), 2);
That line does one thing, but not what I want. Since I filling up the values of the array as bool
and setting all to false
by default, but, index goes from 0-N
.
Is it possible:
int array[std::advance(iter, 2)]
When I run, std::iota(std::begin(array), std::end(array), 2);
then output below looks as that, but, I want it to be: [2]:false, [3]:false, ... N.
Output:
[0]:2
[1]:3
[2]:4
[3]:5
[4]:6
[5]:7
[6]:8
[7]:9
[8]:10
Aucun commentaire:
Enregistrer un commentaire