|
Boost : |
From: Phil Bouchard (philippe_at_[hidden])
Date: 2008-07-21 07:56:53
Hi,
If we look into sandbox/shifted_ptr/bits I've added an archive called
"bits.zip". I archived it because of all the barking SVN was doing. By
unpacking this file we'll find:
stl_list.h
list.tcc
stl_list.h.patch
list.tcc.patch
These files are an overriden version of the Gnu Gcc's 3.4.x headers. Why
Gcc's? Because SGI headers are outdated by many years. Now if we compile
shifted_ptr_test2.cpp with the following then these headers will override
system ones which is perfect:
g++ shifted_ptr_test2.cpp -I ../../..
My example doesn't work anymore but compiles at least. I will work on the
problem but for now we can see the required changes to make STL compliant
with smart pointers in the patch files. I think this is great because this
can help unobfusticate the standards in this matter and containers using
smart pointers means better abstraction and goodbye to a lot of headaches if
we start using sorting, multi-indexing, graph, etc.
In the code itself I am propagating the allocator all over internal classes
(iterators & nodes) and now looks like the following:
template<typename _Alloc>
struct _List_node_base
{
typedef typename _Alloc::template rebind<_List_node_base<_Alloc>
>::other _Node_Alloc_type;
typedef typename _Node_Alloc_type::pointer pointer;
typedef typename _Node_Alloc_type::const_pointer
const_pointer;
typedef typename _Node_Alloc_type::reference reference;
typedef typename _Node_Alloc_type::const_reference
const_reference;
pointer _M_next; ///< Self-explanatory
pointer _M_prev; ///< Self-explanatory
static void
swap(_List_node_base& __x, _List_node_base& __y);
void
transfer(pointer const __first,
pointer const __last);
void
reverse();
void
hook(pointer const & __position);
void
unhook();
};
Furtermore I took the liberty of mixing the Boost License with GPL because I
think these are compatible but feel free letting me know any problem this
may create.
Regards,
-Phil
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk