-1

I am trying to convert std::vector<T>::iterator to void *, but getting compiler error as wrong conversion. is there any way?

Barry
  • 286,269
  • 29
  • 621
  • 977
Dr. Debasish Jana
  • 6,980
  • 4
  • 30
  • 69

1 Answers1

4

Just get the pointer to the vector element with dereference:

vector<Type>::iterator i = ...;
void* data = &*i;

Or to vector data:

void* data = vec.data();
Peter K
  • 1,787
  • 13
  • 15