<div dir="ltr">Shawn,<div>   Firstly thank you for a very clear explanation of the difference between vtkSmartPointer and <span style="font-size:12.8px">std::shared_ptr. It is much appreciated.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Regarding std::unique_ptr.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I think that it will be possible to use std::unique_ptr where it is defined and fall back to std::auto_ptr without too much effort.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Please see the attached zip file for a test scenario.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">However we would need a new define which I have called VTK_HAS_UNIQUE_PTR and</span></div><div><span style="font-size:12.8px">one new macro: CheckCXXTemplatedExpressionCompiles.cmake</span><br></div><div><br></div><div><span style="font-size:12.8px">To test it yourself, change "std::unique_ptr<int> ptr" in line 49 of the CMakeLists.txt file to to something that will never compile e.g "std::Xunique_ptr<int> ptr".</span></div><div><span style="font-size:12.8px">Remember to delete the cache and run CMake again when you do this.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">I have only tested this in windows so it may be buggy.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">If you think this approach is reasonable, I'll have a go at creating a topic.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Of course feedback from anyone else would be appreciated.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Regards</span></div><div><span style="font-size:12.8px">   Andrew</span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 20, 2016 at 1:29 AM, Shawn Waldon <span dir="ltr"><<a href="mailto:shawn.waldon@kitware.com" target="_blank">shawn.waldon@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Andrew,<br><br></div>We have had a few discussions about this and here is (roughly) where I think things stand.  (To the list: feel free to correct/expand this).<span class=""><br><div>> So I have two questions:</div><div>> 1) How do we handle future 
proofing in this case? Most importantly, we need to keep std::auto_ptr 
for older compilers but should move to either std::unique_ptr and/or 
possibly std::shared_ptr. Is there a define that we can use?</div><div><br></div></span><div>Yes std::unique_ptr is the right replacement, but we should check if the compiler/library supports it and fall back to std::auto_ptr.  I don't know of a define that could be used to test this, though one could be added.<br> <br></div><span class=""><div>> Finally:</div><div>> 2)
 vtkSmartPointer ... how does this fit in? To me it seems this similar 
to std::shared_ptr. Could vtkSmartPointer just be a wrapper around 
std::shared_ptr for new compilers (C++11 and newer)?</div><div><br></div></span><div>This was a long discussion, but the summary is this: vtkSmartPointer assumes that the object itself is reference counted internally and will delete itself when that count reaches 0.  std::shared_ptr assumes that it needs to keep the reference count and delete the object when that reaches 0.  These two different takes on reference counting are hard to reconcile and there isn't really a way to easily migrate to use std::shared_ptr.  It is also uncertain if we want to...<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>Shawn<br></div><br><br><div class="gmail_extra"><br></div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">___________________________________________<br>Andrew J. P. Maclean<br><br>___________________________________________</div>
</div>