 
 inline __host__ __device__
 agency::cuda::future<void>
-  move_construct_result(agency::cuda::detail::event& dependency)
-{
-  return agency::cuda::future<void>(std::move(dependency), agency::cuda::detail::asynchronous_state<void>(agency::cuda::detail::construct_not_ready));
+  move_construct_result(agency::cuda::detail::stream& stream, agency::cuda::detail::event& dependency)
+{
+  return agency::cuda::future<void>(std::move(stream), std::move(dependency), agency::cuda::detail::asynchronous_state<void>(agency::cuda::detail::construct_not_ready));
 }
 
 
 template<size_t... Indices, class TupleOfFutures>
 __host__ __device__
-auto move_construct_result_from_tuple_of_futures(agency::detail::index_sequence<Indices...>, agency::cuda::detail::event& dependency, TupleOfFutures& futures)
-  -> decltype(move_construct_result(dependency, agency::detail::get<Indices>(futures).data()...))
-{
-  return move_construct_result(dependency, agency::detail::get<Indices>(futures).data()...);
+auto move_construct_result_from_tuple_of_futures(agency::detail::index_sequence<Indices...>, agency::cuda::detail::stream& stream, agency::cuda::detail::event& dependency, TupleOfFutures& futures)
+  -> decltype(move_construct_result(stream, dependency, agency::detail::get<Indices>(futures).data()...))
+{
+  return move_construct_result(stream, dependency, agency::detail::get<Indices>(futures).data()...);
 }
 
 

  //     we can't do that because that memory cannot be deallocated by a __device__ function
  // XXX we should implement a better memory allocator that can be used uniformly in __host__ & __device__ code

  return move_construct_result_from_tuple_of_futures(agency::detail::make_tuple_indices(view_of_selected_non_void_futures), when_all_execute_event, view_of_selected_non_void_futures);
}



  auto f = make_move_construct_result_functor(result_state.data(), ptr, ptrs...);

  // launch the function
  agency::cuda::detail::event result_event = dependency.then(f, dim3{1}, dim3{1}, 0, stream.native_handle());

  return agency::cuda::future<result_type>(std::move(stream), std::move(result_event), std::move(result_state));
