[Dune] [Dune-Commit] dune-grid r8007 - trunk/dune/grid/test

Oliver Sander sander at mi.fu-berlin.de
Mon Apr 30 14:04:52 CEST 2012


Am 30.04.2012 13:36, schrieb Jö Fahlke:
> Am Fri, 27. Apr 2012, 18:36:01 +0200 schrieb sander at dune-project.org:
>> Modified:
>>     trunk/dune/grid/test/gridcheck.cc
>> Log:
>> Bugfix: now that geometryInFather returns a value instead
>> of a reference, one must not a reference of its return
>> value anymore.
>
> Actually, in the case below it was perfectly legal.  The compiler will make a
> copy of the return value and bind the reference to that; the copy will have
> the same lifetime as the reference itself.  This is useful if you don't know
> whether the return value is a reference or a temporary.  This only works with
> _const_ references, though.
>
There must be a discrepancy between theory and reality, though.  I found 
that
issue because it made test-ug crash after I switched the UGGrid 
LocalGeometries
to the new copy semantics.
--
Oliver


>> Modified: trunk/dune/grid/test/gridcheck.cc
>> ===================================================================
>> --- trunk/dune/grid/test/gridcheck.cc	2012-04-27 16:34:33 UTC (rev 8006)
>> +++ trunk/dune/grid/test/gridcheck.cc	2012-04-27 16:36:01 UTC (rev 8007)
>> @@ -691,7 +691,7 @@
>>     const HierarchicIterator hend = entity.hend( entity.level()+1 );
>>     for( HierarchicIterator hit = entity.hbegin( entity.level()+1 ); hit != hend; ++hit )
>>     {
>> -    const GeometryInFather&geoInFather = hit->geometryInFather();
>> +    GeometryInFather geoInFather = hit->geometryInFather();
>>       const Dune::GenericReferenceElement<  typename Grid::ctype, Grid::dimension>  &refElement
>>         = Dune::GenericReferenceElements<  typename Grid::ctype, Grid::dimension>::general( geoInFather.type() );
>
> Bye,
> Jö.
>
>
>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune




More information about the Dune mailing list