Pinned Tweet
Thread of tips about Generic Programming.
xitter.cf/ericniebler/status/990…
Generic Programming pro tip: Although Concepts are constraints on types, you don't find them by looking at the types in your system. You find them by studying the algorithms.
#cpp
Did grade school suck for you because you were a "problem child" (read: neurodivergent)?
Yes?
My partner @MERottsolk has created the school that we didn't have when we were kids, a place where different is normal. And they're fund raising.
Click here:
zeffy.com/en-US/fundraising/…
Let's play Does It Compileses, Precious?
𝚝𝚎𝚖𝚙𝚕𝚊𝚝𝚎 <𝚌𝚕𝚊𝚜𝚜 𝚃>
𝚜𝚝𝚛𝚞𝚌𝚝 𝚘𝚒𝚗𝚔 {
𝚜𝚝𝚊𝚝𝚒𝚌_𝚊𝚜𝚜𝚎𝚛𝚝(!𝚜𝚝𝚍::𝚒𝚜_𝚟𝚘𝚒𝚍<𝚃>);
𝚜𝚝𝚛𝚞𝚌𝚝 𝚋𝚘𝚒𝚗𝚔 {
𝚜𝚝𝚊𝚝𝚒𝚌_𝚊𝚜𝚜𝚎𝚛𝚝(𝚜𝚝𝚍::𝚒𝚜_𝚟𝚘𝚒𝚍<𝚃>);
};
};
𝚘𝚒𝚗𝚔<𝚒𝚗𝚝> 𝚖𝚎𝚘𝚠;
50%of course it compiles
50%nope, no way
391 votes • Final resultsI found an implementation of `std::declval` that compiles 2x faster than the "standard" one[*]. Rather than overload resolution and SFINAE, this one uses a variable template and a partial specialization:
[*]: tested w/ clang-17
tagging some stdlib implementors: @CoderCasey @wakomeup @LouisDionne. Also, thanks to @LouisDionne for his wonderful metabench tool: github.com/ldionne/metabench
What comes after "Write a simple sender"?
This gist shows how to implement `just`, `then`, `when_all`, `run_loop`, `sync_wait` and more, and it doesn't leave out the cancellation bits.
And it's only ~500 LOC.
gist.github.com/ericniebler/…
Super interesting paper from @seanbax about memory-safety in C++ without lifetime annotations. I hope the C++ committee is receptive! attn: @isocpp
open-std.org/jtc1/sc22/wg21/…
Does anybody else find it mildly concerning that the EDG frontend has a file called "templates.cpp" that is 12,000 lines long? 😬
"Senders Don't Send" by @benfrantzdale
True, but "factory_for_an_immovable_thingy_you_can_start_and_that_will_complete_eventually" is an unwieldy name.
reddit.com/r/cpp/comments/1f…








