Nobody understands templates?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Feb 28 19:52:51 PST 2014


On Sat, Mar 01, 2014 at 01:07:04AM +0000, Jesse Phillips wrote:
> On Friday, 28 February 2014 at 18:42:57 UTC, Steve Teale wrote:
> >Is this typical - libraries use templates, applications don't, or
> >am I just being unimaginative?
> >
> >Steve
> 
> I believe it is typical. However it can also be definition, what is
> a library? What is an application? Certainly your application uses
> libraries, and it is very likely a library you need hasn't been
> written for your application, so you may end up writing libraries.
> If you write a templated function it is to be used in many places
> for many things, shouldn't it be in a library?
> 
> I believe that the majority of an application should be library. I
> can't claim to achieve this or that the libraries I create are not
> monolithic, but it is a view that I think helps to simplify the
> application.

+1. I find that my code tends to be cleaner and better designed when I
write it as though it is going to be a library (even if it doesn't
actually end up being a library). It's a good approach to improve the
quality of the code I write.


T

-- 
If you compete with slaves, you become a slave. -- Norbert Wiener


More information about the Digitalmars-d-learn mailing list