Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Template metaprogramming


Related Topics

In the News (Sat 26 Dec 09)

  
  Template Metaprograms (Todd Veldhuizen)   (Site not responding. Last check: 2007-10-17)
Template metaprograms can generate useful code when interpreted by the compiler, such as a massively inlined algorithm -- that is, an implementation of an algorithm which works for a specific input size, and has its loops unrolled.
The template metaprogram version generates one of statement1, statement2, or default- statement depending on the value of I. Again, since I is used as a template argument, its value must be known at compile time.
Writing a template metaprogram version of this function, the argument N is passed as a template parameter, and the four temporary variables (bit0,bit1,bit2,bit3) are replaced by enumerative types:
extreme.indiana.edu /~tveldhui/papers/Template-Metaprograms/meta-art.html   (2644 words)

  
 Template Metaprograms (Todd Veldhuizen)   (Site not responding. Last check: 2007-10-17)
Template metaprograms can generate useful code when interpreted by the compiler, such as a massively inlined algorithm -- that is, an implementation of an algorithm which works for a specific input size, and has its loops unrolled.
The template metaprogram version generates one of statement1, statement2, or default- statement depending on the value of I. Again, since I is used as a template argument, its value must be known at compile time.
Writing a template metaprogram version of this function, the argument N is passed as a template parameter, and the four temporary variables (bit0,bit1,bit2,bit3) are replaced by enumerative types:
osl.iu.edu /~tveldhui/papers/Template-Metaprograms/meta-art.html   (2644 words)

  
 C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond (C++ in Depth Series)
This book mostly covers just that library, and the various templates that it offers, but what I felt the book should have provided was not only how the more interesting parts of the MPL were implemented, but also interesting applications of the MPL where some interesting algorithm was made possible by template metaprogramming.
To summarize - this is a pretty good introduction to template metaprogramming, but seems to be suited for the unlikely position of someone who wants or needs to use this technique, but isn't academically interested in it, and so mainly needs a walkthrough of the set of standard functions available as part of the MPL.
The template metaprogramming technical topics covered are extremely advanced, and right at the leading edge of C++ library development, yet the step-by-step presentation makes the material understandable even to intermediate programmers.
www.homehealthcareinfo.com /books/isbn0321227255.html   (1099 words)

  
 Template metaprogramming - Wikipedia, the free encyclopedia
Template metaprogramming is a programming technique in which templates are used by a compiler to generate temporary source code, which is merged by the compiler with the rest of the source code and then compiled.
Template metaprogramming is generally Turing-complete, meaning that any computation expressible by a computer program can be computed, in some form, by a template metaprogram.
Template metaprograms have no mutable variables— that is, no variable can change value once it has been initialized, therefore template metaprogramming can be seen as a form of functional programming.
en.wikipedia.org /wiki/Template_metaprogramming   (1336 words)

  
 Metaprogramming - Wikipedia, the free encyclopedia
Metaprogramming is the writing of programs that write or manipulate other programs (or themselves) as their data or that do part of the work that is otherwise done at compile time during runtime.
The most common metaprogramming tool is a compiler which allows a programmer to write a relatively short program in a high-level language and uses it to write an equivalent assembly language or machine language program.
Another still fairly common example of metaprogramming might be found in the use of lex (see also: flex) and yacc (see also: bison), which are used to generate compilers and interpreters.
en.wikipedia.org /wiki/Metaprogramming_(programming)   (515 words)

  
 Addison-Wesley Professional - 0321227255 - C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and ...
Literature on C++ template metaprogramming has focused primarily on details of low-level "tricks" at the expense of strong idioms and abstractions, and without illuminating the path from metaprogramming to expressive interfaces and efficient, maintainable software.
This book is called "C++ Template Metaprogramming" but it should be called "Boost MPL API Reference." The first portion of this book covers the basics of template metaprogramming fairly well, but what I wanted the rest of the book to cover were both advanced techniques and real-world applications.
The template metaprogramming technical topics covered are extremely advanced, and right at the leading edge of C++ library development, yet the step-by-step presentation makes the material understandable even to intermediate programmers.
safari.awprofessional.com /0321227255   (1517 words)

  
 Template metaprogramming
With template metaprogramming the compiler acts as a virtual computer, emitting code optimized for a specific purpose or environment.
Template metaprogramming is an interesting new technique for constructing libraries.
Traditional OO techniques rely on late binding, delaying decisions of what type to use and what methods to call until run time, but with template metaprogramming, extreme early binding is used.
community.borland.com /article/0,1410,10526,00.html   (626 words)

  
 Binary Constants using Template Metaprogramming
A template metaprogram [1] is a C++ program that is interpreted at compile-time.
The similarity between the template metaprogram and the recursive definition in ML is not accidental.
Also, if you want to experiment with metaprogramming, be aware that some compilers (as Borland 4.02) constrain the size of an enum to the size of int, while the draft C++ Standard [4] requires that the smallest integral types that fits should be used.
www.eptacom.net /pubblicazioni/pub_eng/binary.html   (2047 words)

  
 D Programming Language - Templates Revisited
All the templates with the same name are examined upon template instantiation, and the one with the best fit of arguments to parameters is instantiated.
Template recursion combined with specialization means that C++ templates actually form a programming language, although certainly an odd one.
Unfortunately, template metaprogramming in C++ often seems to be relying on side effects rather than being able to expressly code what is desired.
www.digitalmars.com /d/templates-revisited.html   (2223 words)

  
 C++ Template Metaprogramming   (Site not responding. Last check: 2007-10-17)
C++ Template Metaprogramming is wholesome, brilliant, expertly written, well laid out, and incidentally offers a great deal of immensely useful practical tips about using and debugging C++ templates.
With help from the excellent Boost Metaprogramming Library, David and Aleksey take TMP from the laboratory to the workplace with readable prose and practical examples, showing that "compile-time STL" is as able as its runtime counterpart.
Literature on C++ template metaprogramming has focused primarily on details of low-level "tricks" at the expense of strong idioms and abstractions, and without illuminating the path from metaprogramming to expressive interfaces and efficient, maintainable software.
www.boost-consulting.com /metaprogramming-book.html   (645 words)

  
 C++ Templates: Metaprograms > A First Example of a Metaprogram
Metaprogramming consists of “programming a program.” In other words, we lay out code that the programming system executes to generate new code that implements the functionality we really want.
Usually the term metaprogramming implies a reflexive attribute: The metaprogramming component is part of the program for which it generates a bit of code/program.
Metaprogramming often relies on the concepts of traits and type functions as developed in Chapter 15.
www.informit.com /articles/article.asp?p=30667&rl=1   (681 words)

  
 Dr. Dobb's | STL & Generic Programming: C++ Template Metaprogramming | April 15, 2003
Templates were added to C++ for all the good reasons that you’ve read about in your introductory books (e.g., to be able to write container classes without having to specify the type of element that goes into the container).
To emphasize the point that a C++ template metaprogram is a real program, I’ll use the one example that every teacher of programming languages has always used as the first example of a program, namely, the calculation of the factorial of a natural number.
If your template metaprogram causes an infinite recursion at compile time, the explanation is most likely that you have intuitively relied on lazy evaluation when you shouldn’t have [10].
www.ddj.com /184401547;jsessionid=ROTCXB4FLSVAQQSNDLQCKHSCJUNN2JVN?_requestid=193909   (3031 words)

  
 Template Metaprogramming
The metaprogram's task can be as simple as querying the properties (or traits) of a type, or as complex as a lengthy computation that fills a static data structure with, say, the first hundred prime numbers.
Policy-based programming is a style of programming where you write a template that takes a policy as a template parameter, and relies on a specific interface for the policy, and works for any policy that fulfills the interface.
template is a policy template, in addition to being a traits template.
bdn1.borland.com /article/borcon/files/4120/paper/4120.html   (2693 words)

  
 JWF Online - Template Metaprogramming   (Site not responding. Last check: 2007-10-17)
Template Metaprogramming is a useful technique for getting the compiler to do a lot of work for you.
When you want to calculate constants into your code, you can use libraries of template meta-structs as a shorthand instead of whipping out the old calculator or running a costly subroutine at run-time.
Template Metaprogramming can also be used to optimize away loop overhead for known calculations.
cs-people.bu.edu /jwf/template_metaprogramming.htm   (232 words)

  
 The Joel on Software Discussion Group - Recommended books on template metaprogrmaming
They have libraries for aiding template metaprogramming, and the Python library is a staggering example of it.
We have message classes who store data as strings, these classes have template accessors so that one can retrieve the data as a different type, metaprogramming can be used to decide if a type conversion is needed to get to the requested type, this way unnecessary conversions and temporaries can be avoided.
Template metaprogramming has been described as "parlor tricks with templates." As a C++ programmer of 15 years, I would avoid it because it is unlikely your peers will understand the code or be able to maintain it.
discuss.joelonsoftware.com /default.asp?joel.3.347678   (629 words)

  
 What's Wrong with C++ Templates?
There are a couple of very useful things people do with templates: one is writing code that is abstracted over types, and another is a clever trick called template metaprogramming in which programmers use templates to actually make decisions or perform calculations during compilation, sometimes with amazing effects.
Now template.s is assembly code you can look over.) As the example suggests, it turns out that you can get the compiler to solve any problem a Turing machine can solve by means of template metaprogramming.
C++ templates can't use normal run-time C++ code in the process of expanding, and suffer for it: for instance, the C++ factorial program is limited in that it produces 32-bit integers rather than arbitrary-length bignums.
people.cs.uchicago.edu /~jacobm/pubs/templates.html   (3167 words)

  
 [No title]   (Site not responding. Last check: 2007-10-17)
Serving as a tutorial as well as a handbook for experts, this is the book on C++ template metaprogramming.
C++ Template Metaprogramming sheds light on the most powerful idioms of today's C++, at long last delivering practical metaprogramming tools and techniques into the hands of the everyday programmer.
Programmers who have caught the scent of metaprogramming, but for whom it is still mysterious, will finally gain a clear understanding of how, when, and why it works.
www.polyteknisk.dk /butik/vare.asp?varenr=2067980   (424 words)

  
 Template Metaprogramming - ©2001 Josh Walker
Template metaprogramming is both a curiosity and a powerful optimization method.
The mechanics of metaprogramming may require a readjustment from the regular C++ programmer, since the C++ metaprogramming sublanguage resembles a dynamically-typed functional language.
Template-is-function is characterized by a template struct with an enum or typedef as a return value.
home.earthlink.net /~joshwalker1/writing/TemplateMetaprogramming.html   (2035 words)

  
 CppTemplate at CodePedia
Templates make it possible to use one function or class to handle many different data types.
Note that all these functions are in the STL (the latter is called accumulate) and are all templated.
A template class defines how group of classes should be generated as opposed to a class in C++ as being how the group of objects should be generated.
www.codepedia.com /1/CppTemplate   (509 words)

  
 COMP 290-001: Lecture Notes: Template Metaprograms
Template metaprogramming refers to a technique where the template instantiation mechanism of the C++ compiler is used to partially evaluate a program at compile time.
In [Veldhuizen95a] a template metaprogram for bubblesort is described.
The second example is a compile time function for sinus and cosinus that can be used to implement a metaprogram for the FFT, resulting in a single unrolled function for a 256 FFT with all roots evaluated as constants.
photon.poly.edu /~hbr/cs903-F00/lib_design/notes/meta.html   (1008 words)

  
 Template Metaprogramming
In this case, a metaprogram may calculate, at compile-time, the size of signed char, short, int, and long, and decide which type to use for the desired resolution.
The overall solution is simple: the primary definition of the template metaprogram looks for the smallest integral with enough bits; explicit specializations for each integral type provide the termination anchors for the recursive lookup.
A novel use of template metaprogramming, which yields a type as the result of some compile-time calculations, provides a simple and effective solution to a long-standing, annoying portability/efficiency problem.
www.eptacom.net /pubblicazioni/pub_eng/paramint.html   (1907 words)

  
 C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond - $35.99   (Site not responding. Last check: 2007-10-17)
With help from the excellent Boost Metaprogramming Library, David and Aleksey take TMP from the laboratory to the workplace with readable prose and practical examples, showing that "compile-time STL" is as able as its runtime counterpart.
In many ways, that collection of templates was the precursor to the Boost Metaprogramming Library (MPL): It may have been the first library designed to turn compile-time C++ from an ad hoc collection of "template tricks" into an example of disciplined and readable software engineering.
With the availability of tools to write and understand metaprograms at a high level, we've since found that using these techniques is not only practical, but easy, fun, and often astoundingly powerful.
www.awprofessional.com /titles/0321227255   (1534 words)

  
 Views Implementation
The template metaprogramming and traits techniques are used to simplify declaring views by deducing the minimum iterator functionality of two container types.
Next we define a template class which will take our two internal template mapping classes and do the work of defining a typename based on our lookup critera.
Finally we create the template which combines all our internal workings so that only the two iterator types are the required inputs.
www.oonumerics.org /tmpw00/weiser/node5.html   (699 words)

  
 (template metaprogramming) conditional inclusion of the default constructor - C++
(template metaprogramming) conditional inclusion of the default constructor
(using template metaprogramming) that the default constructor is
Re: (template metaprogramming) conditional inclusion of the default constructor
www.thescripts.com /forum/thread618201.html   (186 words)

  
 C++ Template Metaprogramming Concepts Tools Techniques from Boost Beyond C++ in Depth Series ISBN 0321227255
At the time it appeared to Dave to be nothing more than a curiosity, a charming but impractical hijacking of the template system to prove that you can write programs that execute at compile time.
Despite the existence of numerous real systems built with template metaprogramming and the MPL, many people still consider metaprogramming to be other-worldly magic, and often as something to be avoided in day-to-day production code.
Those that are too broken to use effectively for template metaprogramming.
www.cheapestbookprice.com /reviews/0321227255.html   (2190 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.