Intermediate results using expression templates

前端 未结 2 1343
迷失自我
迷失自我 2020-12-18 09:57

in C++ Template Metaprogramming : Concepts, Tools, and Techniques from Boost and Beyond

... One drawback of expression templates is that they tend to

相关标签:
2条回答
  • 2020-12-18 10:18

    I don't understand your question. auto is going to be reused in C++0x for automatic type inference.

    I personally see this as a drawback for expression templates since they often relay on having a smaller life span than the objects they are built upon which can turn out to be false if the expression template is captured as I explain here.

    0 讨论(0)
  • 2020-12-18 10:33

    For now, you can always use BOOST_AUTO() in the place of C++0x's auto keyword to get intermediate results more easily.

    Matrix x, y;
    BOOST_AUTO(result, (x + y) * (x + y)); // or whatever.
    
    0 讨论(0)
提交回复
热议问题