-1

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

Barry
  • 267,863
  • 28
  • 545
  • 906
Dr. Debasish Jana
  • 6,865
  • 4
  • 27
  • 60

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,777
  • 13
  • 15