Boost logo

Boost :

From: Michael Stevens (Michael.Stevens_at_[hidden])
Date: 2004-03-08 12:53:00


Eric,

The recent changes to the new std_min/std_max caused some unexpected problems
in uBLAS. I have narrowed them down to support for boost::numeric::interval
in uBLAS. This is picked up by ublas/libs/test7. This test is however not at
present part of the regression run.

The new std_max (or std_min) is implemented by returning a constant reference
to the return value of std::max. This should be OK as std::max similarly
returns a const reference to one of its const reference parameters. For gcc
this causes some problems when the type is a boost::numeric::interval. The
test case is very simple.

#include <boost/numeric/interval.hpp>
#include <boost/minmax.hpp>

int main()
{
        boost::numeric::interval<float> a,b,c;
        c = boost::std_max(a, a);
}

gcc (2.95.3 and 3.3.1) is only warning "returning reference to temporary". I
am surprised this doesn't show up in more cases. Why gcc thinks it needs a
temporary here is beyond me

Michael

-- 
___________________________________
Michael Stevens Systems Engineering
___________________________________

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk