[Bug libstdc++/57272] node-based containers don't use allocator's pointer type internally
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 17 22:29:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57272
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |potswa at mac dot com
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
In PR55409#c15 David Krauss pointed out that ...
> the simplest case of a fancy pointer is a raw pointer to a class derived from value_type
I hadn't considered that case, and should ensure it works.
Currently I am working on something like this, which should handle it
correctly:
template<typename _Traits,
typename _Tp = typename _Traits::value_type,
typename _Ptr = typename _Traits::pointer>
struct _List_node_traits;
// For C++03 allocators, and C++11 allocators without non-fancy pointers.
template<typename _Traits, typename _Tp>
struct _List_node_traits<_Traits, _Tp, _Tp*>
{
typedef _List_iterator<_Tp> iterator;
typedef _List_const_iterator<_Tp> const_iterator;
typedef _List_node<_Tp> _Node;
typedef __detail::_List_node_base _Node_base;
typedef _Node_base* _Node_base_ptr;
typedef const _Node_base* _Node_base_const_ptr;
typedef typename _Traits::template rebind<_Node>::other _Alloc_type;
typedef __gnu_cxx::__alloc_traits<_Alloc_type> _Alloc_traits;
...
};
#if __cplusplus >= 201103L
// For C++11 allocators with fancy pointers.
template<typename _Traits, typename _Tp, typename _Ptr>
struct _List_node_traits
{
typedef typename _Traits::void_pointer void_pointer;
typedef _List_ptr_iterator<_Ptr> iterator;
typedef _List_ptr_const_iterator<_Ptr> const_iterator;
typedef _List_ptr_node<_Ptr> _Node;
typedef _List_ptr_node_base<void_pointer> _Node_base;
typedef typename _Node_base::_SelfPtr _Node_base_ptr;
typedef typename _Node_base::_ConstSelfPtr _Node_base_const_ptr;
typedef typename _Traits::template rebind<_Node>::other _Alloc_type;
typedef __gnu_cxx::__alloc_traits<_Alloc_type> _Alloc_traits;
...
};
#endif
More information about the Gcc-bugs
mailing list