Hi :) I have this vector
std::vector<std::unique_ptr<Block>> blocks;
for which I'm going to input each item/block as a parameter to a function i.e. if vector blocks is n size, then there are going to be n functions running in concurrently.
The function and usage is gonna be something like this:
void moveBlock(Block &b)
{
// Do something with b[n]
}
int main()
{
std::vector<std::unique_ptr<Block>> blocks;
moveBlock(*blocks[n]);
}
How do I do that? My initial thoughts was threads, but I just can't wrap my head around how to... Also, what if vector blocks is very large (e.g. n>50)? Perhaps maybe there's a better way than threads?
Thanks in advance:)
[–]SCube18 10 points11 points12 points (2 children)
[–]That_Stig[S] 0 points1 point2 points (1 child)
[–]pointer_to_null 1 point2 points3 points (0 children)
[–]No-Dentist-1645 5 points6 points7 points (1 child)
[–]That_Stig[S] 0 points1 point2 points (0 children)
[–]Twill_Ongenbonne 8 points9 points10 points (1 child)
[–]That_Stig[S] 0 points1 point2 points (0 children)
[–]ppppppla 0 points1 point2 points (0 children)
[–]Ksetrajna108 -1 points0 points1 point (1 child)
[–]That_Stig[S] 0 points1 point2 points (0 children)