How does one access a member variable when using placeholders as functors in Thrust sort or filter calls? For example the following
thrust::remove_if(ms.begin(), ms.end(), _1.fInf > global_min)
produces an error
"thrust::detail::functional::actor<thrust::detail::functional::argument<0U>>" has no member "fInf"
How would I write it using a lambda function? I have a working struct functor with operator(), I’m just looking for a more elegant way.
Unfortunately, you can’t access argument members through a placeholder. Placeholder expressions are intended for arithmetic.
If you need to access members of an argument, you’ll need to use a user-defined functor. You could also use a lambda expression if your compiler supports it.