C++ core compute libraries tech lead at @nvidia, father, @isocpp member, former nomad, and sometimes artist wannabe. Views are mine, not my employer's

Seattle, WA
Joined September 2010
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
6
7
1
49
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/…
3
1
14
1,979
She overheard one student telling another over lunch: "This is the first time in my life that I feel safe." This place is saving lives. That's not an exaggeration.
7
1,344
Let's play Does It Compileses, Precious? 𝚝𝚎𝚖𝚙𝚕𝚊𝚝𝚎 <𝚌𝚕𝚊𝚜𝚜 𝚃> 𝚜𝚝𝚛𝚞𝚌𝚝 𝚘𝚒𝚗𝚔 { 𝚜𝚝𝚊𝚝𝚒𝚌_𝚊𝚜𝚜𝚎𝚛𝚝(!𝚜𝚝𝚍::𝚒𝚜_𝚟𝚘𝚒𝚍<𝚃>); 𝚜𝚝𝚛𝚞𝚌𝚝 𝚋𝚘𝚒𝚗𝚔 { 𝚜𝚝𝚊𝚝𝚒𝚌_𝚊𝚜𝚜𝚎𝚛𝚝(𝚜𝚝𝚍::𝚒𝚜_𝚟𝚘𝚒𝚍<𝚃>); }; }; 𝚘𝚒𝚗𝚔<𝚒𝚗𝚝> 𝚖𝚎𝚘𝚠;
50%of course it compiles
50%nope, no way
391 votes • Final results
9
1
24
5,114
Should be is_void_v, sorry.
1
6
1,328
I 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
7
6
71
5,544
... and this implementation is 3x faster than the standard `declval`, but it doesn't handle abominable function types correctly. <shakes fist>
1
11
1,145
So where are the cool kids these days?
44%Mastadon
56%BlueSky
134 votes • Final results
5
4
1,976
Given all the Things, it's time to listen to some Rage Against The Machine.
3
774
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/…
This remains my favorite tweet about senders.
1
4
40
3,033
There is no such standard algorithm, is there?
8
1
18
4,437
WAIT WAIT this is totally wrong do not call `std::forward` of the same object more than once please forget you saw me post this and don't EVER do this in your code
4
1
47
1,605
The out-of-memory daemon ... crashed?
2
3
28
2,732
Every time I wrap `max` in parens, I curse the Windows team under my breath.
10
3
1
59
10,651
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/…
2
4
86
6,029
Does anybody else find it mildly concerning that the EDG frontend has a file called "templates.cpp" that is 12,000 lines long? 😬
11
9
4,922
Y'all are acting like it's nothing for a single source file to be 10K+ LOC. Once a file is over 1K I have a hard time keeping track of what is where. Recursive decomposition -- breaking things up -- makes them more manageable. Modules, classes, functions ... and files too.
6
1
19
1,938
"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…
6
1
21
2,535