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

Method Compare

06.08-orderingComparisonString2/main.cpp:39–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected