Closed GoogleCodeExporter closed 9 years ago
Hi Sun, thanks for your suggestion.
I agree that &data[0] is ugly, but it's also the way the STL works. The
upcoming C++0x standard adds a .data() member function to the vector container
that returns a pointer. We've gone ahead and added .data() to host_vector and
device_vector, so you can now do
device_ptr<float> dev_ptr = my_device_vector.data();
to get a device_ptr to the underlying data, or
float * raw_ptr = raw_pointer_cast(my_device_vector.data());
to convert the device_ptr to a raw pointer. I understand this isn't quite as
simple as you probably wanted, but it is the closest we can get while
conforming to the C++0x standard.
[1]
http://code.google.com/p/thrust/source/browse/thrust/detail/vector_base.h#284
Original comment by wnbell
on 11 Jul 2010 at 6:51
Thank you for your help. You are right. Mantaining the consistency of interface
is important for productivity. The data() method is good. I like it.
Original comment by SunMingming
on 12 Jul 2010 at 6:31
Marking as WontFix
Original comment by jaredhoberock
on 12 Jul 2010 at 8:43
Original issue reported on code.google.com by
SunMingming
on 11 Jul 2010 at 10:43