|Re: [eigen] Interesting C++ standard proposal|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: Eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] Interesting C++ standard proposal
- From: Hauke Heibel <hauke.heibel@xxxxxxxxx>
- Date: Tue, 12 Nov 2013 09:59:48 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Qq5f/0DKh5pEd6Wa+6WI1zA56lHg3ttGPdIHJEqG5mQ=; b=xQelk0aMq3JGfxtLW08becRWKsYToV+le5b00tJIZ6Dm0HFHyOnBBsXh3awVLr66ju W9noedZE9Sp1//hjGtHBeApzD9bQ09o9nKVlDb4KLmPyj3IwTWZwucBVAPFhm0yVr0ZT NaPyFK6bPSxDj/A2jnnET3RVK4dwL7VC/n+UwJTmfXfLXf5RlLgymBPoYR3trEsX6giU aOWL8xfXzQAWFD9vUgVk+RMtTzKnYqukNgO78z7vEUt1glrm2xswJDmRVs0r4hcP+oI/ XPtOZkTBQI7rVO2LRPMtm2ttlmYJ2fk7GNJvW5BJhkRQ3vPL6JurU9owsusBB9EgF7MA QGZQ==
I don't see the proposal as a way of guessing what the user wants but as a means of being able to impose the type auto resolves to on the user.
Regarding the debug capabilities and code cleanness, it's an ongoing discussion. In my opinion the variables should be properly named. As for debugging I am in the lucky position that VS shows me the exact type behind any variable, including auto declared ones.
In general, I don't see things becoming worse but quite the opposite. Eigen is a linear algebra library and in my opinion the regular user should never see nor know about the template expressions. They are an implementation detail which allows the generation of most optimal code but nothing the user should ever really get in touch with.
According to the proposal, your example becomes:
auto mat = A+B*(C-2*D).cwisePow(2);
explicit auto expr = (A+B*(C-2*D).cwisePow(2));
The general case would be implemented such that auto resolves to (expr).eval() for any _expression_ expr - totally natural in my opinion.