Re: [eigen] "plain": a new keyword for auto with implicit evaluation |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Hi Gaël,
In principle I like the idea of having such a "keyword" but here are some critical thoughts about this: 1. If a user is not familiar with the library to such an extend that he doesn't know that auto should be avoided, how can we expect him to be aware of plain? Therefore the advantage I see is to provide a way to avoid verbose syntax for users that are aware of the auto problem. 2. Using plain (using the implementation you provided) can have performance penalties in the case of object slicing: MatriXi foo() { MatriXi a, b; plain c = a * b; return c; } Object slicing prevents copy elision! That said, you would somehow need to communicate that you can use plain but shouldn't in that or that use case. Don't know if it isn't easier to just remeber that auto should be avoided.
There are a lot of awesome things possible if we enable C++17 (or even C++14) functionality and I'm sure we should allow some of them some day. However, using a deduction guide for this case could be problematic since there could be existing code around that uses auto knowing that the result will be an _expression_. Cheers, DT |
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |