Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Wiki MarkupSTL containers that take predicate functors are perfectly free to make multiple copies of the predicate, and often do, because typically predicates are passed by value. (\[[Meyers 01|AA. Bibliography#Meyers 01]\] Item 38) If a predicate stores and uses internal state, then its state values at the end of a predicate-based function call are implementation-defined, and usually unexpected.

Non-Compliant Code Example

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

ARR44-CPP

low

likely

high

P3

L3

Bibliography

...

\[[Meyers 01|AA. Bibliography#Meyers 01]\] Item 39: Make predicates pure functions

...

ARR43-CPP. Do not access collapsed elements from a remove(), remove_if() or unique() operation      06. Arrays and the STL (ARR)      07. Characters and Strings (STR)