I can declare an array of movable pointers with no problems. I then try to fill it with pointers to elements in another array with a loop in an init function. However, this can't be done as just "pointers[j] = &data[j]", since I'm not initializing the array at this point.
I need movable pointers to fill it with, and the only way I see to create a movable pointer is by declaring a movable pointer variable. However, that variable must have the same value it was initialized with when it goes out of scope, which defeats the purpose in an initialization loop:
Code: Select all
void bfifo_init(block_fifo_t & fifo)
{
for(int j = 0; j < BLOCK_COUNT; ++j)
{
fifo.blocks[j] = &fifo.block_data[j];// doesn't work, since RHS isn't a move expression
fifo_block_t * movable tmp = &fifo.block_data[j];
fifo.blocks[j] = move(tmp);
...tmp goes out of scope here, and needs its pointer back...
}
...
}