home bbs files messages ]

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,123 of 33,346   
   K. Frank to James Kanze   
   Re: What are some simple, practical exam   
   14 Jul 13 23:31:44   
   
   From: kfrank29.c@googlemail.com   
      
   Hi Richard and James!   
      
   On Sunday, July 14, 2013 6:26:24 AM UTC-4, James Kanze wrote:   
   > On Friday, July 12, 2013 8:00:03 AM UTC+1, K. Frank wrote:   
   >   
   > > 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.   
   >   
   > How complex does it have to be to be considered template   
   > metaprogramming?   
      
   That's a good question.   
      
   First, let me say that I think that the examples that Richard and   
   James gave of using traits and similar techniques to specialize or   
   "tune" a template's implementation to specific types and type   
   capabilities is a good and broadly useful example.   
      
   I was, however, imagining examples that used more of the full   
   (unexpected) computational power of the template system.  However, I   
   don't have a well-defined criterion for how complex such an example   
   should be.   
      
   I guess that means that I'm asking for "relatively simple programming   
   challenges" for which somewhat complex template metaprogramming offers   
   a good solution.   
      
   > In general, complex template metaprogramming will be forbidden by   
   > the local coding guidelines, because it quickly leads to unreadable   
   > and unmaintainable code.   
      
   Is that to say that worthy examples of complex template   
   metaprogramming are rare, or that complex template metaprogramming is   
   something of a solution in search of a problem?   
      
   Or is complex template metaprogramming a potentially useful technique   
   that would be more practical if the template system had been designed   
   with metaprogramming in mind (as, according to my understanding, it   
   wasn't)?   
      
   (As a side question, would such local coding guidelines permit or   
   discourage the use of libraries (e.g., blitz++, boost/spirit) that use   
   complex template metaprogramming, as distinct from writing one's own   
   complex template metaprograms?)   
      
   > But there are a lot of the basics which I use almost daily: things   
   > like using a member   
      
   { Quoted signature removed -mod }   
      
   Thanks for your thoughts.   
      
      
   K. Frank   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca