Ask Your Question
2

What is the definition of the operator < for std::set that uses pointers?

asked 2021-05-22 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-05-31 22:00:00 +0000

bukephalos gravatar image

The operator < for std::set that uses pointers is a comparison operator that compares two pointers. It compares the addresses the pointers point to, not the values held in the memory the pointers point. The comparison is typically defined as a lexicographical comparison, meaning it compares the pointers from left to right until a difference is found. If both pointers are equal or the first arguments points to an object with a lower address than the second argument, the function returns true, otherwise it returns false.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-05-22 11:00:00 +0000

Seen: 15 times

Last updated: May 31 '21