Matches in DBpedia 2014 for { <http://dbpedia.org/resource/Expression_templates> ?p ?o. }
Showing items 1 to 16 of
16
with 100 items per page.
- Expression_templates abstract "Expression templates is a C++ template metaprogramming technique in which templates are used to represent part of an expression. Typically, the template itself represents a particular kind of operation, while the parameters represent the operands to which the operation applies. The expression template can then be evaluated at a later time, or passed to a function. The technique was invented independently by Todd Veldhuizen and David Vandevoorde.For example, consider a library representing vectors with a class Vec. It is natural to want to overload operator- and operator* so you could write Vec x = alpha*(u - v); where alpha is a scalar and u and v are Vecs. A naive implementation would have operator- and operator* return Vecs. However, then the above expression would mean creating a temporary for u-v then another temporary for alpha times that first temporary, then assigning that to x. Even with the return value optimization this will allocate memory at least twice: once for the temporary u-v and once for the result of the overall expression.Expression templates delay evaluation so the expression Vec x = alpha*(u-v); essentially generates at compile time a new Vec constructor. It is as if this constructor takes a scalar and two Vecs by reference; it allocates the necessary memory and then performs the computation. Thus only one memory allocation is performed.The 2011 standard of C++ includes rvalue references, which remove the need for expression templates in the most common cases. In the above example, if Vec has an rvalue-compatible constructor (known as a move constructor) and an rvalue-compatible operator* then these will not allocate any memory, so a new Vec is allocated only once (in the expression u - v). Expression templates may be considered a workaround for the lack of move semantics in the previous C++ standard. An alternative technique is to directly emulate move semantics, for example using the Boost move library.An example implementation of expression templates is as follows (using the curiously recurring template pattern as is used by Boost.uBLAS):With the above definitions, the expression alpha*(u-v) is of typeso calling Vec x = alpha * (u-v) calls the constructor that takes a VecExpression<VecScaled<VecDifference<Vec,Vec> > >. Each line of the for loop then expands fromto essentiallywith no temporaries needed and only one pass through each memory block.".
- Expression_templates wikiPageExternalLink move.html.
- Expression_templates wikiPageID "21015558".
- Expression_templates wikiPageRevisionID "552288154".
- Expression_templates hasPhotoCollection Expression_templates.
- Expression_templates subject Category:C++.
- Expression_templates subject Category:Metaprogramming.
- Expression_templates comment "Expression templates is a C++ template metaprogramming technique in which templates are used to represent part of an expression. Typically, the template itself represents a particular kind of operation, while the parameters represent the operands to which the operation applies. The expression template can then be evaluated at a later time, or passed to a function.".
- Expression_templates label "Expression Templates".
- Expression_templates label "Expression templates".
- Expression_templates sameAs Expression_Templates.
- Expression_templates sameAs m.059_snd.
- Expression_templates sameAs Q1384824.
- Expression_templates sameAs Q1384824.
- Expression_templates wasDerivedFrom Expression_templates?oldid=552288154.
- Expression_templates isPrimaryTopicOf Expression_templates.