This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

STL w/ smart pointers


Greetings,

I am submitting preliminary patches required for the STL to support smart pointers as node pointers. The changes aren't too important in contrast to the benefits we get from this. If STL can support smart pointers thru "allocator::pointer" then we'll be able acheiving better abstraction and thus better support for algorithms such as merging, sorting, multi-indexing, graphing, ... of containers.

These patches are partial and offer a great example on a "std::list<>" instanciated using a special allocator having "allocator::pointer" as a smart pointer. Furthermore I have added temporary definitions of "_List_node_base<_Alloc>::hook()" and "_List_node_base<_Alloc>::unhook()" in "list.tcc" to complete non-existant ones in libstdc++. Last but not least I am assuming there is implicit conversions between a "T *" and a "allocator::pointer" of type "smart_ptr<T>" either with its constructor or with conversion operators inside the smart pointer.

As a matter of fact, we can find the entire example inside the following directory:
https://svn.boost.org/svn/boost/sandbox/shifted_ptr/


Where:
- shifted_ptr\boost\shifted_allocator.hpp: example of allocator and smart pointer having implicit conversions
- shifted_ptr\libs\smart_ptr\example\shifted_ptr_test2.cpp: test file (which compiles but doesn't run properly yet)


Obviously any help is appreciated having this ported to std::map, stack, vector, etc. The changes are minimal in regards to the benefits and having support from Gcc's experts would help tremendously.


Regards, -Phil

Attachment: stl_list.h.patch
Description: Binary data

Attachment: list.tcc.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]