Hey, fuckface! Think fast! template<typename F> void invokeFoo(F& f) { f.foo(); } struct Fooable { void foo() {} }; int main() { Fooable c; invokeFoo(c); } This is normal C++ code—nothing particularly nefarious afoot. invokeFoo is a function that takes a hopefully-fooable argument and, well, calls its foo method. That’s fine and well, but what if we further assume that F::foo is a member template?…
This post originally appeared in Volume 0, Issue 3 of unpressed . After several years of making websites, only now have I realized that you can just define your own HTML elements. Like, HTML tags. You can just roll your own. There are no special keywords necessary. You just do it. 1 Here: <!DOCTYPE html> <html> <head> <style> your-very-own-element[something="burger"] { display: block; font-size:…
This post originally appeared in Volume 0, Issue 1 of unpressed . A few weeks ago, I was shown by a dear friend a snippet of C++ (I’ll once again take the opportunity to emphasize friend —i.e., not an enemy) involving the use of operator<< , the stream insertion operator , from the Wikipedia page on argument dependent lookup. The snippet looked something like this: operator<<(std::cout, "Hi…
You know what’s stuck on my mind? Ever since writing my last post , it’s been the word “better.” It came up when we were talking about overload resolution and implicit conversion sequences. I explained a necessary special case of it—something about how adding const in a reference-binding is preferred against—and then strategically shut up about the rest. void run(int (**f)()); // #1 void run(int…
Couldn’t keep yourself away, eh? Or maybe I couldn’t keep myself away. In any case: I’ve prepared for you a classic tale from everyone’s favourite book: ISO/IEC 14882:2020 . It’s a tragedy, of course. All of them are. Now, gather ’round… ∗ ∗ ∗ One of the flagship features that shipped with C++20 a few years ago was an overhaul to comparisons. Gone are the days of writing six different operators…
It has been three days. The room is cold and dark, but your screens are blinding. You feel disoriented as you come in and out of dissociative episodes. Now and again, you laugh, to no accompaniment. Why are you here? Was this your fault? Your first mistake was to engage—this much is clear. ∗ ∗ ∗ Back when I took a first course in C++ a few years ago, I was taught that, under certain circumstances,…