MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / getCompareValue

Function getCompareValue

lib/infer.cpp:35–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34template<class Predicate, class Compare>
35static const ValueFlow::Value* getCompareValue(const std::list<ValueFlow::Value>& values, Predicate pred, Compare compare)
36{
37 const ValueFlow::Value* result = nullptr;
38 for (const ValueFlow::Value& value : values) {
39 if (!pred(value))
40 continue;
41 if (result)
42 result = &std::min(value, *result, [compare](const ValueFlow::Value& x, const ValueFlow::Value& y) {
43 return compare(x.intvalue, y.intvalue);
44 });
45 else
46 result = &value;
47 }
48 return result;
49}
50
51namespace {
52 struct Interval {

Callers 1

fromValuesMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected