nowfound

Dev tools · January 21, 2016

Curious Namespace Trick – Limited static polymorphism in C++

Wiki:. Contribute to dchichkov/curious-namespace-trick development by creating an account on GitHub.

Curious Namespace Trick – Limited static polymorphism in C++ launched on January 21, 2016 with 41 votes, #1,941 of 4,522 launches that month and more than 90% of that year's launches. The site was still online in September 2026, 10 years on.

In plain words

Curious Namespace Trick is a C++ development technique that enables static polymorphism for functions and template types without using weak linking, CRTP, or traits. Developers can define multiple implementations of functions—such as platform-specific optimizations—that get selected at compile time through namespace conventions. The method allows common code to coexist with specialized implementations like ARM-accelerated versions while maintaining inline optimization, making it useful for cross-platform library development.

written from the facts on this page · September 2026

From the sources

This technique is an alternative to weak linking, CRTP, traits, etc. and allows limited static polymorphism for functions, template functions and template types. Lets use an example of cross-platform math library. It implements add() function and dot() function that calls add() : Now, we have some common add() and dot() code, and we also have a faster add() implementation for arm platform. We want to override common implementation and we want it to be nicely inlined too. Here are the steps: 1. In the common code we put '_' in the function definitions (but not in the function calls): 2. And after every function we include the following aliasing magic: 4. We build the code with platform…from github.com

Does a similar job

all alternatives →
  • GI
    Going into freshman year, figured I should build an interpreter2023 · ▲138

    Hi all! I'm going into my freshman year, and figured that the best way to prepare for the intro to programming Racket course would be to implement my own garbage-collected, dynamically typed, functional programming language in C ;) Anyways... here's the repo: https://github.com/liam-ilan/crumb I started learning C over the summer, so I still have a whole lot to learn... Any feedback would be greatly appreciated! :D

  • A dbg(...) macro for C++2019 · github.com · ▲162

    A dbg(…) macro for C++. Contribute to sharkdp/dbg-macro development by creating an account on GitHub.

  • Cppmatch – Rust-Like Pattern Matching and Error Handling for C++2025 · github.com · ▲42

    I've created cppmatch, a lightweight, header-only C++ library that brings Rust-inspired pattern matching and error handling to C++. It tries to imitate the functionality of the questionmark (?) operator in C++ by using a macro that uses the gcc extension https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html This allows to create exceptionless code with non-intrusive error-as-value that unlike Exceptions, makes it clear which kinds of error a function can generate and forces you to handle (or ignore) them. The ? operator translates to *expect* To handle the errors I…

  • C++ runtime/compile-time detection in constexpr functions2017 · github.com · ▲83

    An approach for runtime detection inside a constexpr function - SaadAhmad/in_constexpr

  • AI
    Anyone interested in a tool helps to explore C++ ASTsMay 2026 · uvic-aurora.github.io · ▲49

    I built this software to help users who need to do static code analysis for C/C++ codebase. This can help you to explore the ASTs interactively. It can replace the Clang ast dump completely and also you can search the code/ASTs in a structual way. For example you can search a function which matches specific name or number of paremeters.

  • A Fast, Malloc-Free C++14 Json Parser and Encoder2014 · github.com · ▲98

    Meta programming utilities for C++14. Merged in matt-42/lithium - matt-42/iod

More dev tools this month

the category →
  • /dev/null▲489

    a social network for devs

    Dev tools · 3d ago · dev-null.sh

  • open-source IDE for thoughtful software design. Contribute to devdotfast/whiteboard development by creating an account on GitHub.

    Dev tools · 28d ago · github.com

  • Contribute to reladraw/reladraw development by creating an account on GitHub.

    Dev tools · 26d ago · github.com

  • OpenBot▲362

    Grok Bot alternative: free, local, open-source, multiplayer

    Dev tools · 23d ago · openbot.run

  • Talanoa▲346

    Hi HN, I’m a fullstack developer, and honestly, I’ve lost count of how many side projects I’ve worked on over the years. But one idea kept coming back to me: a different kind of email client. It first came to me in 2014: “What if we could handle emails more like conversations?” Every year, I’d revisit this concept in my “Build Notes.” Ten years later, no one had built exactly what I had in mind — so I finally decided to do it myself. That’s how Talanoa was born. I wanted something focused on people, not timelines. I was tired of marking messages as unread just to remember to reply later, or…

    Dev tools · 21d ago · talanoa.email

  • CoreSpeed▲332

    One MCP for everything your agents need: apps, memory, tools

    Dev tools · 28d ago · corespeed.io

Source: Show HN post ↗

Launched alongside, January 2016

the whole month →
  • Siftery▲1,018

    Share products you use at work,explore what others are using

    Work · 2016 · siftery.com

  • Grade your website's strengths and weaknesses in seconds.

    Growth · 2016 · website.grader.com

  • Truebill▲766

    Find your paid subscriptions and cancel with one click

    Commerce · 2016 · rocketmoney.com

  • Oristand▲749

    A super affordable, portable standing desk

    Work · 2016 · oristand.co

  • Rapportive on steroids. See data about contacts in Gmail.

    Growth · 2016 · clearbit.com

  • Create a viral waiting list in 60 seconds

    Growth · 2016 · app.referralhero.com