[Insight-users] Histogram class.

Luis Ibanez luis . ibanez at kitware . com
Fri, 20 Jun 2003 13:01:16 -0400


Hi Raghavendra,

The method

     const MeasurementType & GetMeasurement()


is returning a const reference to a temporary
variable created by the static_cast<>.

Probably the signature of this method should
be modified for returning just the measurement
type. Like

     MeasurementType   GetMeasurement()

That's account for the 'warning'

---

The 'error' may be produce by your own code
if you are receivinig this value as:


   MeasurementType &  myValue = histogram->GetMeasurement();

Please use

   MeasurementType  myValue = histogram->GetMeasurement();




   Luis


-----------------------------------------
Raghavendra Chandrashekara wrote:
> Dear All,
> 
> I am trying to use the histogram class to output the measurement value 
> for a particular bin and dimension. I am using the following function in 
> the itk::Histogram class:
> 
> MeasurementType& GetMeasurement (const unsigned long n, const unsigned 
> int dimension) const
> 
> But when I try to compile I get the following error message:
> 
> /vol/vipdata/packages/InsightCVS/Code/Numerics/Statistics/itkHistogram.txx: 
> In method `double & 
> itk::Statistics::Histogram<double,1,itk::Statistics::DenseFrequencyContainer<float> 
>  >::GetMeasurement(long unsigned int, unsigned int) const':
> /homes/rc3/src/VIPITK/Tests/HistogramTest/HistogramTest.cxx:72: 
> instantiated from here
> /vol/vipdata/packages/InsightCVS/Code/Numerics/Statistics/itkHistogram.txx:447: 
> initialization of non-const reference type `double &'
> /vol/vipdata/packages/InsightCVS/Code/Numerics/Statistics/itkHistogram.txx:447: 
> from rvalue of type `double'
> /vol/vipdata/packages/InsightCVS/Code/Numerics/Statistics/itkHistogram.txx:447: 
> warning: returning reference to temporary
> make[1]: *** [HistogramTest.o] Error 1
> make: *** [default_target] Error 2
> 
> Please could you tell me what this error might mean.
> 
> Thanks,
> 
> Raghavendra
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>