Back to front pageView on Hacker News (opens in a new tab)Ask HN: What is the most beautiful piece of code you've ever read?476 pointsby seisvelas (on Hacker News)7 years agoPreferably an elegant snippet rather than an entire (well engineered) codebase.Comments (380) 116 threadsShow all commentsShowing thread 23 of 116[-]nicolapede7 years ago1 reply#Curiously Recurring Template Pattern (CRTP) [0] in C++. class Derived : public Base [0] https://en.wikipedia.org/wiki/Curiously_recurring_template_p...[-]snak7 years ago1 reply#That's awesome. I ran into this situation in C#, and looks like it is useful in some cases.https://zpbappi.com/curiously-recurring-template-pattern-in-...kmote007 years ago#tl;dr: "Generally, whenever you need the derived class information in the base class, you are probably looking for CRTP."
Ask HN: What is the most beautiful piece of code you've ever read?476 pointsby seisvelas (on Hacker News)7 years ago
nicolapede7 years ago1 reply#Curiously Recurring Template Pattern (CRTP) [0] in C++. class Derived : public Base [0] https://en.wikipedia.org/wiki/Curiously_recurring_template_p...
snak7 years ago1 reply#That's awesome. I ran into this situation in C#, and looks like it is useful in some cases.https://zpbappi.com/curiously-recurring-template-pattern-in-...
kmote007 years ago#tl;dr: "Generally, whenever you need the derived class information in the base class, you are probably looking for CRTP."
Comments (380) 116 threads
Show all comments
Showing thread 23 of 116
https://zpbappi.com/curiously-recurring-template-pattern-in-...