 
                            ...
Compliant Solution (std::reference_wrapper)
This compliant solution wraps uses std::ref to wrap the predicate in a std::reference_wrapper<T> object, ensuring that copies of the wrapper object all refer to the same underlying predicate object.
...
Using a predicate function object that contains state can produce unexpected values.
| Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level | 
|---|---|---|---|---|---|---|
| CTR58-CPP | Low | Likely | Yes | HighNo | P3 P6 | L3 L2 | 
Automated Detection
| Tool | Version | Checker | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Helix QAC | 
 | C++3225, C++3226, C++3227, C++3228, C++3229, C++3230, C++3231, C++3232, C++3233, C++3234 | ||||||||||||
| Parasoft C/C++test | 
 | CERT_CPP-CTR58-a | Make predicates const pure functions | PRQA QA-C++ | ||||||||||
| Include Page | PRQA QA-C++_V | PRQA QA-C++_V | 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234 | |||||||||||
| Polyspace Bug Finder | 
 | CERT C++: CTR58-CPP | Checks for function object that modifies its state (rule fully covered). | Helix QAC | | Include Page |  | Helix QAC_VHelix QAC_V | 
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...