If you want to look up an element in a range by value or by predicate, the most straightforward options are the three linear find algorithms:
std::find (find element by value)
std::find_if (find element using a positive predicate)
std::find_if_not (find element using a negative predicate)
All three algorithms have parallel (C++17) and range variants (C++20).
Leave a comment
ncG1vNJzZmirmaK8r8DOrZ9nq6WXwLWtwqRlnKedZL1wsMCio7Jlkp7BpnnOn2ScZaOpsae1zZ1krKyUm7avsL6inWZulmk%3D
The std::iota is a simple algorithm that generates consecutive values by repeatedly applying the prefix increment, starting from the initial value.
While the base std::iota algorithm is fairly niche, the C++20 lazily evaluated std::views::iota is a more helpful version, particularly when combined with other views.
Leave a comment
ncG1vNJzZmirmaK8r8DOrZ9nq6WXwLWtwqRlnKedZL1wsMCio7Jlkp7BpnnOn2ScZaOpsaq705pkrKyUq7amw9Kipq2Z
The std::lower_bound and std::upper_bound are arguably the two most practically useful algorithms in the standard library.
Both algorithms are binary searches, operating in O(logn) on sorted ranges.
The std::lower_bound returns an iterator to the first element not ordered before the provided value and std::upper_bound to the first element ordered after the provided value.
Note that the number of comparisons is still O(logn) on non-random-access ranges. However, the number of iterator increments is O(n).
Who doesn't love surprise endings?
The Damian Lillard Trade Saga and the NBA summer itself came to a dramatic and deliciously unforeseen conclusion Wednesday when the Portland Trail Blazers completed a deal to send the beloved Lillard to the Milwaukee Bucks.
No: Lillard will not be joining the glitzy franchise in Miami that for months was said to be the only team he would willingly join.
Yes: This was a blockbuster of the highest grade to pair Lillard with Giannis Antetokounmpo and a trade we will be dissecting and discussing for months to assess all of its various impacts.
Damn Bitch You Live Like This?
2024-12-04
There is a long history on the internet of making children’s cartoons modern. Maybe it’s a failure to grow up and needing the comforts of childhood there to help us. Maybe it’s an acknowledgement of our first crushes. Maybe it’s a first draft idea that everyone has and only some people act on because they think it’s deep. No version of it really lasts though, not without the meme treatment. Our most enduring version, is of course, Max and Roxanne from A Goofy Movie.
Dan Carlin On Tour Announcement
2024-12-04
As we mentioned in the recent Hardcore History show, I am going to do a live tour of selected cities in late March/early April. I haven't done many of these, but the ones that I have done have been received enthusiastically enough that I've been asked to do more.
The current line up is Los Angeles on March 21st 2024, Salt Lake City March 23, Portland, Oregon March 28, and New York City on April 9.
Note: This article was originally published on Nov. 9, 2023. Because of the importance of the subject matter — and because the platform that published it no longer exists — I am re-publishing it here without a paywall.
Andrea Hurley had seen that look on her husband’s face before. It worried her.
This was April 12, nine days after her husband, Dan, had coached UConn to the NCAA men’s basketball championship.
Dan Tobin | Substack
2024-12-04
Dan Tobin 🐘💨Writer, teacher, epic self-describer. Odd writing portfolio: The Boston Phoenix, a couple network television sitcoms, lot of blogging. Teaching 6th grade English at a public middle school in Cambridge, MA since 2011. World’s first triple EGOT.
ncG1vNJzZmirpZfAta3CpGWcp51kjaWtza2mm6Ge
Danger Will Robinson - by Robert
2024-12-04
I started rewatching a show that I encountered as a wee youth; Lost in Space. To be clear, the original show aired in the 1960s and was already old by the time I started watching it in the late 1980s and early 90s. No, I am not talking about that show. I am talking about the Netflix remake that lasted for three seasons. Whenever I rewatch this show I ge…