should <bits/unique_ptr.h> include <backward/auto_ptr.h>?

Jonathan Wakely jwakely.gcc@gmail.com
Mon Jun 25 23:19:00 GMT 2012


On 25 June 2012 23:54, Benjamin De Kosnik wrote:
>
>
>> I'm working on std::wstring_convert and want to use std::unique_ptr.
>
> Yay for working on this.

I've done wstring_convert, wbuffer_convert is mostly done, I need to
finish off the tests and submit.  At some point I might tackle
codecvt_utf8 etc. but you might be better at that (having done the
ext/codecvt_specializations.h pieces.)

> Using std::unique_ptr seems like something we
> should be encouraging!!!

Definitely.

>> To avoid <locale> pulling in the whole of <memory> I only want to
>> include unique_ptr.h, but that means I also need to include
>> <backward/auto_ptr.h>.  If bits/unique_ptr.h included auto_ptr.h
>> itself then we could just use unique_ptr.h elsewhere in the library
>> more easily.
>
> Hmm. Can you detail why you need auto_ptr.h at all? I must be missing
> something. I see there are no current includes of it in any bits
> headers, which seems ideal.

Both shared_ptr and unique_ptr have constructors taking an auto_ptr
parameter, they just don't explicitly include the header because the
usual way to use them is <memory> which includes auto_ptr.h before
including shared_ptr.h or unique_ptr.h

>> Currently <future> includes the whole of <memory> but IIRC all it
>> really needs is unique_ptr.h, shared_ptr.h and allocator.h
>
> bits/memory_base.h?
>
> bits/memory_classes.h?

Makes sense.



More information about the Libstdc++ mailing list