|Re: [eigen] still the solve() API debate|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] still the solve() API debate
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Fri, 11 Sep 2009 20:13:11 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=JWoHijgWSzcoM6/AQyo44WuxFeKW1xRa2ibslkYaeAs=; b=qDjE1XelkO8kIEtVRjq/pvLfZZpnxY7S1d1Iysltez0XcPVep2nUqStJnc/BIEhPgD RL5kATvZdXwilXRyKlZ2eHec50kjfEiiakE6K9rf5x2tvPXh3AEihfuWMU6zwzYZgIRS csO/cuRGNtb7FLotC0s1wvRLO65J593pk2WH4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=M7rMVJ8cwLyKfkLvdd8GG2Be7rWpt15KOYl6xKFKm+fQbVoJdbIRG5IW2mfnASKqwS QIR8oiICqyZSYbs/+0KHxLNnnRrtCgJtFWwrZBAXaVsJGT9NC/8OuZjpzNa6cP9EcRYw T6WGMEPE4G6tV+sbPCkNkwJp5/hOQhPR+cKGM=
On Fri, Sep 11, 2009 at 5:17 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> OK, coming back to seriousness: I like your idea, I'm just not sure
> about the INOUT name. Maybe the more verbose EIGEN_REF_TO_TEMPORARY
> would be more explicit as to what it does and why we have to do it?
Of course, anything would be fine here...
> +1 to Hauke's idea to keep rvalue refs in mind;
Actually Gael's, I just moved the const. :)
Ok, I just did some reading (this is a cool article:
and then I recalled something from "Effective STL" which confused me a
bit. One item in "Effective STL" deals with "the swap trick" to trim
the capacity of std::vector....
Now I was wondering how this should work facing the rvalue issue we
are having with swap since the idea is to swap a vector with a
temporary rvalue object that is empty. After looking at the
std::vector::swap implementation I recognized that it is implemented
as expected with a non-const reference, so how can this work? Well,
swap is commutative and what they do is simply to put the rvalue
object on the left-hand-side like this:
std::vector<double>().swap(v); // as opposed to ...
So, now I am just asking... could we not just use void
MatrixBase::swap(MatrixBase<OtherDerived>& other) and force the user
to use e.g.
I am just wondering...
Going back to the solve API. What about
MagicReturnType<...> solve(const MatrixBase<...>& b) const; // and
void solve(MatrixBase<...>& b) const;
For the first one we may pass rvalue objects and everything is fine
and for the second one, well, rvalue objects don't make any sense...
so here we don't care.