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.
------------------------------------------------------
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
|
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.