| 2820 | } |
| 2821 | |
| 2822 | static std::string minmaxCompare(const Token *condTok, nonneg int loopVar, nonneg int assignVar, LoopType loopType, bool invert = false) |
| 2823 | { |
| 2824 | if (loopType == LoopType::RANGE && !hasVarIds(condTok, loopVar, assignVar)) |
| 2825 | return "std::accumulate"; |
| 2826 | std::string algo = "std::max_element"; |
| 2827 | if (Token::Match(condTok, "<|<=")) |
| 2828 | algo = "std::min_element"; |
| 2829 | if (condTok->astOperand1()->varId() == assignVar) |
| 2830 | algo = flipMinMax(algo); |
| 2831 | if (invert) |
| 2832 | algo = flipMinMax(algo); |
| 2833 | return algo; |
| 2834 | } |
| 2835 | |
| 2836 | static bool isTernaryAssignment(const Token* assignTok, nonneg int loopVarId, nonneg int assignVarId, LoopType loopType, std::string& algo) |
| 2837 | { |
no test coverage detected