Replies: 1 comment 1 reply
-
|
I would be cautious to try to infer information on an iterator by inspecting the presence and properties of a nested For example, the system of an using pointer = int*;
pointer operator->() { .. }
I think your approach of specializing namespace thrust {
template<class Ptr>
struct iterator_system<MyIterator<Ptr>> : iterator_system<Ptr> {};
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This question is about helping Thrust deduce the
systemof a custom iterator.I have a custom iterator for which I want Thrust to determine its "system".
For example
In principle, Thrust, by default, could look if the iterator has a pointer type inside and, if so, determine the system for it.
At the moment, I have to do this:
This has two problems: one, it is very easy to get wrong (when MyIterator has many template parameters), and second, it introduces a hard dependency on Thrust, when Thrust could have deduced this.
Note that in principle, this could be transparent to the user (e.g., if Ptr is a thrust::pointer)
I could not achieve this in the primary template iterator_system and iterator_system_impl definitions, but I may be missing something.
Is there a better way than using the specialization above explicitly?
If not, could Thrust do this by default (i.e., deduce system from internal pointer)?
Beta Was this translation helpful? Give feedback.
All reactions