[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Patch: auto_ptr is frequently abused in TSVN code

From: Dmitry <wipedout_at_yandex.ru>
Date: Fri, 28 Aug 2009 08:57:41 +0400

According to answers to http://stackoverflow.com/questions/1044785/c-autoptr-for-arrays using vector for simple control over an array lifetime is a recommended way - because the storage is guaranteed to be contiguous and because you don't need to reinvent it.

However vector has two problems: first, it doesn't have anything like auto_buffer::release() which is used once in a while in TSVN code and second, retrieving the buffer (T* pointer) can only be done with a very ugly construct - &buf[0] - (discussed here: http://stackoverflow.com/questions/1339470/how-to-get-the-address-of-the-stdvector-buffer-start-most-elegantly ).

So I guess for this very scenario the introduced auto_buffer suits even better than vector.

Dmitry.

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2388111

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-08-28 07:39:47 CEST

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.