Subject: Re: [ublas] example usage of coordinate_matrix fails on Ubuntu 11.04 (amd_64)
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2011-12-11 06:47:34
David Bellot wrote:
> if it's ublas related, then no, because 1.48 is not different than 1.47 (w.r.t ublas).
> I don't really have time these days to work on a solution due to my current job,
> but if someone has a patch I'll have time enough to push it for 1.49.
Well, the failing line is in
std::inplace_merge (ita.begin (), iunsorted, ita.end ());
The attached patch modifies "std::inplace_merge" appropriately...
The issues boils down to the fact that for "Forward Iterators", the return value of "*a" must be convertible to "T&" (see for example <http://stdcxx.apache.org/doc/stdlibref/iterators.html>). But a temporary value cannot bind against a non-const reference, so these requirements can only be satisfied if the return value of "*a" actually has the type "T&" (please correct me if I'm wrong). But this makes it impossible to use proxy_objects with iterators, and hence makes many actual usages of iterators (like this one here) impossible, or at least not standard conform (again, please correct me if I'm wrong). The reactions to related issues in Boost.Multi_Array/Boost.Iterator (see <http://lists.boost.org/Archives/boost/2011/11/187501.php>) don't motivate me to invest much of my time into this issue.
The issue here could also be solved by replacing the call to std::inplace_merge with a "hand-rolled" implementation of "inplace_merge". Note however that the implementation should be based neither on "Dinkum STL library by P.J. Plauger" (=stl used by MSVC), nor on "libstdc++ from gnu" (=stl used by gcc/g++), because their licenses are not compatible with the boost license. Some of the stl implementations referred to at <http://en.wikipedia.org/wiki/Standard_Template_Library#Implementations> (probably) have a usable license, but I would have to ask somebody like Ion Gaztañaga or Vicente Botet to find out details (like where/whether I would have to put acknowledgments and license text/references). One could also try to rewrite "inplace_merge" from scratch, but my own motivation for doing that is pretty low.