Wondering if this code will actually run on the vex v5 brain

so im starting to program my teams robot using pros, and i dont really like the new pros v4 MotorGroup, so i created my own. my motorgroup class store the motors in a vector. I want all of the motors to be updated in terms of movememnt/braking, and because they are in a vector id have to loop through and set each motor. to implement this i used the c++ 17 execution header to specifiy to run a for_each function in parallel, which hopefully means the motors are updated in parallel too.

this is my implementation:

        for_each(
            execution::par,
            motors.begin(),
            motors.end(),
            [speed](Motor& motor){
                motor.move(speed);
            }
        );

but i am not 100% sure that the vex v5 brain can actually run this code.

The brain does not support the C++ STL execution::par policy for parallel algorithms. This is because the brain doesn’t have multiple cores, like a regular CPU, and only has 1 thread.

Just use a for loop.

2 Likes

Thanks that I had a bunch that was the case.