I think it is worthwhile looking at the details of unique_ptr and differences. Howard Hinnant describes this well and provides an implementation of unique_ptr for c++03. May be overkill and as crypto++ use of auto_ptr is limited and potentially safer than usual, maybe an ifdef block could be used although template typedefs are really also a c++11 feature, so care required AFAIK cross compiler with such a feature in c++03 implementations.
Anyway this link is worth a read https://howardhinnant.github.io/unique_ptr03.html On Mon, Jul 27, 2015 at 10:27 PM, Jeffrey Walton <[email protected]> wrote: > > > On Monday, July 27, 2015 at 5:10:05 PM UTC-4, Jeffrey Walton wrote: >> >> >> >> On Monday, July 27, 2015 at 5:04:35 PM UTC-4, ruben.de.smet wrote: >>> >>> I would rather call the used class unique_ptr and revert to auto_ptr, >>> instead of calling it auto_ptr when in fact it will be a unique_ptr in the >>> future. It will avoid confusion for people fiddeling with the code, because >>> people will think they can pass them around at will when they in fact >>> can't. >>> >>> Other than that, going towards C++11: I like it! >>> >> >> OK, good idea. >> >> I'll get tit cut-over like that shortly. >> > > My bad... that's wont work. This unique_ptr and this only works in C++11: > > template<typename T> > using auto_ptr = std::unique_ptr<T>; > > How about something like: > > template <typename T> struct local_ptr { > #if defined(CTYPTOPP_CXX11) > typedef std::unique_ptr<T> ptr; > #else > typedef std::auto_ptr<T> ptr; > #endif}; > > > Jeff > > -- > -- > You received this message because you are subscribed to the "Crypto++ > Users" Google Group. > To unsubscribe, send an email to > [email protected]. > More information about Crypto++ and this group is available at > http://www.cryptopp.com. > --- > You received this message because you are subscribed to the Google Groups > "Crypto++ Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- David Irvine twitter: @metaquestions blog: http://metaquestions.me -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
