#include <algorithm>
#include <cassert>
#include <iostream>
#include <agency/execution_policy.hpp>

int main()
{
  using namespace agency;

  size_t n = 1 << 16;
  std::vector<float> x(n, 1), y(n, 2), z(n);
  float a = 13.;

  bulk_invoke(vec(n), [&](vector_agent &self)
  {
    auto i = self.index();
    z[i] = a * x[i] + y[i];
  });

  float expected  = a * 1. + 2.;
  assert(std::all_of(z.begin(), z.end(), [=](float x){ return expected == x; }));

  std::cout << "OK" << std::endl;

  return 0;
}


#include <algorithm>
#include <cassert>
#include <iostream>
#include <agency/execution_policy.hpp>

int main()
{
  using namespace agency;

  size_t n = 1 << 16;
  std::vector<float> x(n, 1), y(n, 2), z(n);
  float a = 13.;

  bulk_invoke(vec(n), [&](vector_agent &self)
  {
    int i = self.index();
    z[i] = a * x[i] + y[i];
  });

  float expected  = a * 1. + 2.;
  assert(std::all_of(z.begin(), z.end(), [=](float x){ return expected == x; }));

  std::cout << "OK" << std::endl;

  return 0;
}


--- 
+++ 
@@ -13,7 +13,7 @@
 
   bulk_invoke(vec(n), [&](vector_agent &self)
   {
-    int i = self.index();
+    auto i = self.index();
     z[i] = a * x[i] + y[i];
   });
 
Use auto when grabbing the agent's index, otherwise we don't get vectorization
