C++ Expression Templates

前端 未结 3 1066
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-09 00:01

I currently use C for numerical computations. I\'ve heard that using C++ Expression Templates is better for scientific computing. What are C++ Expression Templates in simple

3条回答
  •  无人及你
    2020-12-09 00:50

    Adding to sbi's answer, expression templates implement high-level peephole optimizations using templates for pattern matching and synthesis.

    They also add syntactic sugar, or make your code more readable, by allowing you to specify the algorithm in terms of simple operations. So, in this case, simplicity and elegance are achieved through optimization by metaprogramming. At least, if you do everything right.

提交回复
热议问题