title: call of an object of a class type without appropriate operator()
body: <p>I have this following function to test out thrust but it doesn't compile. It appears my predicate is not valid and my knowledge of C/C++ is not strong enough to know what I need to do correct the compilation issue. Please could someone explain what's going on here and how I can fix it.</p>
  
  <pre><code>void filter(device_vector&lt;int&gt;&amp; x, 
                  device_vector&lt;int&gt;&amp; y,
                  thrust::unary_function&lt;int,bool&gt; f) {
  
      thrust::copy_if(x.begin(), x.end(), y.end(), f);
  }
  
  
  nvcc -o test test.cu -O2
  /usr/lib/nvidia-cuda-toolkit/include/thrust/detail/internal_functional.h(102): error: call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type
            detected during:
              instantiation of "__nv_bool thrust::detail::predicate_to_integral&lt;Predicate, IntegralType&gt;::operator()(const T &amp;) [with Predicate=thrust::unary_function&lt;__nv_bool, int&gt;, IntegralType=std::ptrdiff_t, T=int]" 
  /usr/lib/nvidia-cuda-toolkit/include/thrust/detail/function.h(187): here
              instantiation of "Result thrust::detail::host_device_function&lt;Function, Result&gt;::operator()(const Argument &amp;) const [with Function=thrust::detail::predicate_to_integral&lt;thrust::unary_function&lt;__nv_bool, int&gt;, std::ptrdiff_t&gt;, Result=std::ptrdiff_t, Argument=thrust::device_reference&lt;int&gt;]" 
  /usr/lib/nvidia-cuda-toolkit/include/thrust/iterator/transform_iterator.h(306): here
              instantiation of "thrust::detail::transform_iterator_base&lt;AdaptableUnaryFunction, Iterator, Reference, Value&gt;::type::reference thrust::transform_iterator&lt;AdaptableUnaryFunction, Iterator, Reference, Value&gt;::dereference() const [with AdaptableUnaryFunction=thrust::detail::predicate_to_integral&lt;thrust::unary_function&lt;__nv_bool, int&gt;, std::ptrdiff_t&gt;, Iterator=thrust::detail::normal_iterator&lt;thrust::device_ptr&lt;int&gt;&gt;, Reference=std::ptrdiff_t, Value=thrust::use_default]" 
  /usr/lib/nvidia-cuda-toolkit/include/thrust/iterator/iterator_facade.h(128): here
              instantiation of "Facade::reference thrust::iterator_core_access::dereference(const Facade &amp;) [with Facade=thrust::transform_iterator&lt;thrust::detail::predicate_to_integral&lt;thrust::unary_function&lt;__nv_bool, int&gt;, std::ptrdiff_t&gt;, thrust::detail::normal_iterator&lt;thrust::device_ptr&lt;int&gt;&gt;, std::ptrdiff_t, thrust::use_default&gt;]" 
  /usr/lib/nvidia-cuda-toolkit/include/thrust/iterator/iterator_facade.h(305): here
  </code></pre>