MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / Compare

Method Compare

06.10-orderingComparisonString3/main.cpp:37–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35};
36
37std::weak_ordering String::Compare(const String& a, const String& b)
38{
39 if(a.mLen == b.mLen && std::equal(a.begin(), a.end(), b.begin(), b.end())) {
40 return std::weak_ordering::equivalent;
41 }
42
43 if(std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end())) {
44 return std::weak_ordering::less;
45 }
46
47 return std::weak_ordering::greater;
48}
49
50#define CMP_PRINT(op, expected) \
51 { \

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected