asherliu / thrust

Automatically exported from code.google.com/p/thrust
Apache License 2.0
0 stars 0 forks source link

Make backend::dereference more scalable #357

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Right now, we implement backend::dereference by overloading it for each new 
iterator.  Because it is implemented via overloading, we have to declare all 
the overloads before their use (in thrust/detail/backend/dereference.h).  This 
isn't very scalable and creates circular inclusion problems.

A better way to implement backend::dereference would be via template 
specialization.  Specializations need not be declared before their use.

thrust::detail::backend::dereference should be defined generically:

template<typename Iterator>
  typename dereference_result<Iterator>::type
    dereference(Iterator iter)
{
  return some_specializable_template<Iterator>::dereference(iter);
}

We could eliminate all the overload declarations this way and keep the 
specialization implementations with the individual iterator implementations.

Original issue reported on code.google.com by jaredhoberock on 19 Aug 2011 at 10:35

GoogleCodeExporter commented 8 years ago
A similar issue exists with raw_pointer_cast.

raw_pointer_cast should be defined generically:

template<typename Pointer>
  typename raw_pointer_cast_result<Pointer>::type
    raw_pointer_cast(Pointer ptr)
{
  return some_specializable_tempalte<Pointer>::raw_pointer_cast(ptr);
}

The alternative would be to use adl everywhere we use raw_pointer_cast.

Original comment by jaredhoberock on 24 Aug 2011 at 9:24

GoogleCodeExporter commented 8 years ago

Original comment by jaredhoberock on 31 Aug 2011 at 12:13

GoogleCodeExporter commented 8 years ago
dereference no longer exists

Original comment by jaredhoberock on 23 Jan 2012 at 10:24