Less than operator. ! \note Invalid pointers are always greater than valid ones. */
| 388 | \note Invalid pointers are always greater than valid ones. |
| 389 | */ |
| 390 | bool operator<(const GenericPointer& rhs) const { |
| 391 | if (!IsValid()) |
| 392 | return false; |
| 393 | if (!rhs.IsValid()) |
| 394 | return true; |
| 395 | |
| 396 | if (tokenCount_ != rhs.tokenCount_) |
| 397 | return tokenCount_ < rhs.tokenCount_; |
| 398 | |
| 399 | for (size_t i = 0; i < tokenCount_; i++) { |
| 400 | if (tokens_[i].index != rhs.tokens_[i].index) |
| 401 | return tokens_[i].index < rhs.tokens_[i].index; |
| 402 | |
| 403 | if (tokens_[i].length != rhs.tokens_[i].length) |
| 404 | return tokens_[i].length < rhs.tokens_[i].length; |
| 405 | |
| 406 | if (int cmp = std::memcmp(tokens_[i].name, rhs.tokens_[i].name, sizeof(Ch) * tokens_[i].length)) |
| 407 | return cmp < 0; |
| 408 | } |
| 409 | |
| 410 | return false; |
| 411 | } |
| 412 | |
| 413 | //@} |
| 414 |