logoalt Hacker News

quuxplusonetoday at 1:31 PM0 repliesview on HN

I wouldn't call the idiom you describe (like with unique_lock's defer_lock_t constructor) "tag dispatch"; to me, one defining characteristic of the "tag dispatch idiom" is that the tag you're dispatching on is computed somehow (e.g. by evaluating iterator_traits<T>::iterator_category()). The idiom you're describing, I'd call simply "a constructor overload set" that happens to use the names of "disambiguation tags" to distinguish semantically different constructors because — as you point out — C++ doesn't permit us to give distinct names to the constructor functions themselves.

For more on disambiguation tags, see https://quuxplusone.github.io/blog/2025/12/03/tag-types/

and https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p39...