Meaning of some expressions

bool operator()(char const *a, char const *b) { return std::strcmp(a, b) < 0; }
So what does the return statement mean?

Aceix.
http://cplusplus.com/reference/cstring/strcmp/

Return Value

Returns an integral value indicating the relationship between the strings:
A zero value indicates that both strings are equal.
A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2; And a value less than zero indicates the opposite.


This means:
- true is returned if a lexicographically precedes b
- false otherwise, including if they're the same string
Last edited on
Hi,
What about the <0 stuff.

Aceix.
You should take a look at the link provided above, strcmp can return any of the 3 separate values (-1,0,1) depending on the order of the strings provided as arguement.
Last edited on
Topic archived. No new replies allowed.