On Thu, Jul 23, 2015 at 08:50:55PM +0000, Vlad Levenfeld via Digitalmars-d wrote: > On Thursday, 23 July 2015 at 20:40:17 UTC, Walter Bright wrote: > >On 7/23/2015 12:50 PM, H. S. Teoh via Digitalmars-d wrote: > >>That assumes the template author is diligent (foolhardy?) enough to > >>write unittests that cover all possible instantiations... > > > >No, only each branch of the template code must be instantiated, not > >every possible instantiation. And we have a tool to help with that: > >-cov > > > >Does anyone believe it is a good practice to ship template code that > >has never been instantiated? > > I dunno about good practices but I have some use cases. > > I write a bunch of zero-parameter template methods and then pass them > into a Match template which attempts to instantiate each of them in > turn, settling on the first one which does compile. So the methods > basically form a list of "preferred implementation of functionality > X". All but one winds up uninstantiated. [...]
But don't you still have to test each template, to make sure they compile when they're supposed to? T -- Without geometry, life would be pointless. -- VS