[Dune-devel] Casting C pointers to std::unique_ptr

Simon Praetorius Simon.Praetorius at tu-dresden.de
Mon Jun 25 15:41:20 CEST 2018


There is an implementation ToUniquePtr<T> in dune-common, see  
dune/common/to_unique_ptr.hh that does exactly this. It was  
implemented shortly after the last meeting. It is basically a  
unique_ptr that allows to cast to raw pointers, but gives a warning  
that this is deprecated.

But, there was already a discussion to deprecate this ToUniquePtr in  
favor of a real unique_ptr. Currently it is available and not  
deprecated.

Best regards,
Simon

Zitat von Oliver Sander <oliver.sander at tu-dresden.de>:

> Dear Dune team,
>
> I vaguely remember that at the last dev meeting in Heidelberg it was
> requested that file readers should return std::unique_ptr<Grid>
> instead of Grid*.  It was then (at least, I remember it that way),
> proposed that, to allow a smooth transition, we should implement
> a special transitional pointer type that would cast to both C-style
> pointers and std::unique_ptr.  What has happened to that idea?
> Is there a prototype, or at least parts of it?
>
> Best regards,
> Oliver



-- 
Dr. Simon Praetorius
Institut für Wissenschaftliches Rechnen
Fakultät Mathematik
Technische Universität Dresden
Tel.: TUD-34432
Mail: simon.praetorius at tu-dresden.de
Web: www.math.tu-dresden.de/~spraetor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5753 bytes
Desc: S/MIME-Signatur
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20180625/cbb03740/attachment.bin>


More information about the Dune-devel mailing list