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

Jö Fahlke jorrit at jorrit.de
Mon Apr 30 13:36:16 CEST 2012


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.

> 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ö.

-- 
Jorrit (Jö) Fahlke, Interdisciplinary Center for Scientific Computing,
Heidelberg University, Im Neuenheimer Feld 368, D-69120 Heidelberg
Tel: +49 6221 54 8890 Fax: +49 6221 54 8884

A mathematician is a device to turn coffee into theorems.
-- Paul Erdős
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20120430/5a27c0bb/attachment.sig>


More information about the Dune mailing list