使用 thrust 调试不完整的类型错误
Debugging incomplete type errors with thrust
我已经对 unary_function 和 binary_functions 进行了大量的推力调试,但我已经成功地找到了它们。 yes_type in:
中除一个和不完整类型错误外的所有错误
namespace is_assignable_ns
{
template<typename T1, typename T2>
class is_assignable
{
typedef char yes_type;
typedef struct { char array[2]; } no_type;
template<typename T> static typename add_reference<T>::type declval();
template<unsigned int> struct helper { typedef void * type; };
template<typename U1, typename U2> static yes_type test(typename helper<sizeof(declval<U1>() = declval<U2>())>::type);
template<typename,typename> static no_type test(...);
public:
static const bool value = sizeof(test<T1,T2>(0)) == 1;
}; // end is_assignable
} // end is_assignable_ns
有人知道我目前正在使用的推力操作可能会调用哪些推力操作吗:
#include <thrust/remove.h>
#include <thrust/count.h>
#include <thrust/unique.h>
#include <thrust/execution_policy.h>
我必须处理的唯一错误是:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include\thrust/detail/type_traits.h(607): error : incomplete type is not allowed
任何调试方法都将不胜感激!
在 thrust::unique() 中发现我在 unique operator= 中使用的结构没有返回,因此在通过 yes_type() 时返回了不完整的类型。
我已经对 unary_function 和 binary_functions 进行了大量的推力调试,但我已经成功地找到了它们。 yes_type in:
中除一个和不完整类型错误外的所有错误namespace is_assignable_ns
{
template<typename T1, typename T2>
class is_assignable
{
typedef char yes_type;
typedef struct { char array[2]; } no_type;
template<typename T> static typename add_reference<T>::type declval();
template<unsigned int> struct helper { typedef void * type; };
template<typename U1, typename U2> static yes_type test(typename helper<sizeof(declval<U1>() = declval<U2>())>::type);
template<typename,typename> static no_type test(...);
public:
static const bool value = sizeof(test<T1,T2>(0)) == 1;
}; // end is_assignable
} // end is_assignable_ns
有人知道我目前正在使用的推力操作可能会调用哪些推力操作吗:
#include <thrust/remove.h>
#include <thrust/count.h>
#include <thrust/unique.h>
#include <thrust/execution_policy.h>
我必须处理的唯一错误是:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\include\thrust/detail/type_traits.h(607): error : incomplete type is not allowed
任何调试方法都将不胜感激!
在 thrust::unique() 中发现我在 unique operator= 中使用的结构没有返回,因此在通过 yes_type() 时返回了不完整的类型。