This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc 3.5 integration branch proposal


Scott Robert Ladd <coyote at coyotegulch dot com> wrote:
 > Gabriel Dos Reis wrote:
 >  > Just for my education, what is insane use of C++?  IS Boots sane or
 >  > insane use of C++?
 > 
 > Insane, but useful and necessary for people who insist on using (or are 
 > required to use) C++ for heavy-duty array crunching. Such code is ugly, 
 > difficult to debug, and the only way C++ can approach Fortran 95's 
 > elegance. As such, a compiler needs to effectively handle template 
 > madness -- or we tell them all to use a *real* numerical language like 
 > Fortran 95 ;)

:-).  Well, I haven't atually studied the referenced code, but I'm guessing
this is a reference to use of expression templates.  I'd just like to point
out that such template "insanity" has applications that go far beyond array
processing.  

For example, on my current project we have employed "glommable expression
templates" to allow trivial augmentation of functors with ET status.  This
allows scan-and-classify loops that might ordinarily have been written with
quadruply nested compose/bind/select complexity, to be expressed with
trivially simple logical operators acting on functor predicates.

For example, to locate an element with properties ABC and QRS from a
sequence, we would say:

	  find_if( x.begin(), x.end(), IsABC() || IsQRS() );

instead of the more verbose STL predicate composer style.

You probably still think it's insane, but anyway my point is that it applies
far beyond numeric processing contexts.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]