Template metaprogramming: Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile web edit
Line 137:
== Static Table Generation ==
 
The benefit of static tables is the replacement of "expensive" calculations with a simple array indexing operation (for examples, see [[lookup table]]). In C++, there exists more than one way to generate a static table at compile time. The following listing shows an example of creating a very simple table by using recursive structs and [[Variadic templates]].
The table has a size of ten. and eachEach value is just the indexsquare multipliedof withthe itselfindex.
In C++ exists more than one way to generate a static table at compile time.
The following listing shows an example of creating a very simple table by using recursive structs and [[Variadic templates]].
The table has a size of ten and each value is just the index multiplied with itself.
 
<syntaxhighlight lang="cpp">