This is related, but I think separate from #725. I cannot call std::sort using thrust::device_vector<T>::iterator. Compiling the below with AppleClang + libc++ I get the error message shown below, while compilation succeeds using AppleClang + libstdc++.
Reproducer:
#include <algorithm>
#define THRUST_DEVICE_SYSTEM 4 // CPP
#include <thrust/device_vector.h>
int main(int argc, char** argv)
{
thrust::device_vector<int> a(10);
std::sort(a.begin(), a.end());
return 0;
}
Error message:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:3856:17: error:
no matching function for call to 'swap'
swap(*__first, *__last);
where the relevant overload is
thrust/thrust/detail/device_reference.inl:49:6: note:
candidate function [with T = int] not viable: expects an l-value for 1st
argument
void swap(device_reference<T> &a, device_reference<T> &b)
I tried adding overloads to thrust::swap, which instead accept either device_reference<T> or device_reference<T>&&, but then get the following error message. I'm just guessing at this point.
thrust/thrust/detail/reference.inl:196:3: error:
call to 'iter_swap' is ambiguous
iter_swap(select_system(*system, *system), m_ptr, other.m_ptr);
This is related, but I think separate from #725. I cannot call
std::sortusingthrust::device_vector<T>::iterator. Compiling the below with AppleClang + libc++ I get the error message shown below, while compilation succeeds using AppleClang + libstdc++.Reproducer:
Error message:
where the relevant overload is
I tried adding overloads to
thrust::swap, which instead accept eitherdevice_reference<T>ordevice_reference<T>&&, but then get the following error message. I'm just guessing at this point.