function template specialization question D vs. C++

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sun Jan 14 02:32:06 UTC 2018


On Sunday, January 14, 2018 02:24:52 Adam D. Ruppe via Digitalmars-d-learn 
wrote:
> On Sunday, 14 January 2018 at 02:14:50 UTC, Jonathan M Davis
>
> wrote:
> > If you're using template constraints rather than template
> > specializations, then you can't have any unconstrained
> > templates.
>
> Not true: see the tip of the week here
> http://arsdnet.net/this-week-in-d/2016-sep-04.html

Well, that's a neat trick to get around the restriction that I stated, but
it doesn't really make what I said untrue. Unless you're using template
specializations, you can't overload an unconstrained template. That tip just
shows a way to combine template specializations and template constraints so
that you get the same effect as if you were allowed to overload
unconstrained templates with constrained templates without using template
specializations.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list