 #include <thrust/execution_policy.h>
 #include <iostream>
 
-template<class RandomAccessIterator>
+template<class Iterator>
 class range_view
 {
 public:
-  typedef RandomAccessIterator iterator;
+  typedef Iterator iterator;
 
 private:
   const iterator first;


  saxpy_kernel<<<1, 1>>>(
      2.0, 
      make_range_view(thrust::make_transform_iterator(X.cbegin(),f1()), thrust::make_transform_iterator(X.cend(),f1())),
      make_range_view(Y.cbegin(), thrust::distance(Y.cbegin(), Y.cend())),
      make_range_view(Z.data().get(), 4)
      );
  assert(cudaSuccess == cudaDeviceSynchronize());

  for (int i = 0, n = Z.size(); i < n; ++i)

struct f1 : public thrust::unary_function<float,float>
{
  __host__ __device__
  float operator()(float x) const
  {
    return x*3;
  }
