-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Doc] Clarify bsearch(_custom)
behavior
#89280
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can do for now.
Although #69451 would almost supersede this PR with another example outright in the decade it gets merged.
Except your example there doesn't showcase the effect of |
I won't, I'll make sure of it next rebase. |
The original issue was closed by some weird mistake and the example apparently did exist at some point, but the only trace of it I could find is on my private fork. Here's what I could recover:
|
I think a more extensive example for I can unlink this from the doc issue and someone can add a custom example But I don't think an example will help to any real degree, either you get what a comparison method is for your specific use case, or you don't, an example isn't going to make it any clearer for you if you don't know how to achieve what you want, IMO |
KoBeWi's example looks nice enough. Outside of nitpicks, the only thing I'd change is the last line, as the comment is superfluous with Callables.
|
Please try to make the bit about the A Thousand Ships tried to explain it to me here. Maybe it's a start. |
You are linking to a comment by me 🙃 And that's just the code that does this internally, not an example But as I said above I'm not adding a specific example to that part, i.e. the custom part, given my raeasons above, the example I give shows the behavior as before/after the position, please look, so confused as to why you are asking for an example when one is there? |
I am confused now. What example? Could be my ignorance. Have checked latest docs online, but see nothing. Am I looking in the right place? |
This hasn't been merged so the docs aren't updated, look at the changes in this PR :) |
If you mean the addition to ..then I must say that this doesn't help (me) understand that before argument. Why not add an example using false? |
While we're at it, can anyone write something to explain what this means:
The sense of it does not leap from the screen. What is an 'insertion index'? What is 'sorting order'? Why would a value not be in the array yet? |
411698a
to
57d1f3a
Compare
* Added an example for the effect of `before` * Clarified the arguments to the custom callable can be either order
57d1f3a
to
06df4ab
Compare
Thanks! |
Thank you! |
Cherry-picked for 4.2.2. |
before
Didn't specify that the order of the arguments in the callable is based on the
before
argument as it's an implementation detail, unlikely to change, but relevant to not lock into