Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 33,125 of 33,346    |
|    Ian Collins to K. Frank    |
|    Re: What are some simple, practical exam    |
|    14 Jul 13 23:36:41    |
      From: ian-news@this.is.invalid              K. Frank wrote:       >       > Hello Group!       >       > What are some simple examples that illustrate the benefits       > of template metaprogramming?       >       > What I have in mind would be examples that "speak to"       > programmers (like me) who don't have much experience       > with template metaprogramming.       >       > I'm looking for relatively simple programming challenges       > that most programmers would have encountered for which       > template metaprogramming would offer a good -- or even       > compelling -- solution.       >       > So the classic textbook example of calculating factorials       > at compile time, while cool, isn't really a good example       > in this sense because it's contrived.              It may be contrived, but the principal is sound. If you want to loop at       compile time, TMP solutions are the only way to go.              Here's an equally simple example from the function mocking framework I       use for unit tests. In the framework, all the test objects derive from       a simple class template:               template |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca