Overloaded functions are unsuitable for this, because the earlier overloads don't see the later ones (except via ADL, which usually isn't good enough). Make a class template and specialize it instead. You can wrap it in a function for a prettier call syntax.
↧
Comment by HolyBlackCat on Is there a way to have "partially recursive" function constraints in C++?
↧