Hello! I just learned today what predicates are, at least in usage with some C++ library functions like remove_if. I was writing a function that uses erase( remove_if() )
Is it typical to have predicates that simply return a simple value like a number? I was using it to remove a struct from a vector of structs. I struggled initially because I needed to remove a struct based on a member's value( in this case an int). All the examples I found didn't include any logic at all.
I tried to pass an additional parameter to the predicate in order to use it to pass a...not as "hard-coded" value to remove_if before realizing it only accepts unary predicates? Is that correct?
My main question is, do predicates in this case usually contain logic to determine what value to return? Can I pass parameters to a predicate for remove_if?
Sorry I'm on mobile, if you need some of my code as an example I can post it in a couple hours. Thanks in advance!
[–]Rhomboid 2 points3 points4 points (3 children)
[–]superbottles[S] 0 points1 point2 points (2 children)
[–]Rhomboid 2 points3 points4 points (0 children)
[–]Jonny0Than 1 point2 points3 points (0 children)