[Boost-bugs] [Boost C++ Libraries] #3249: ptr_list of const items

Subject: [Boost-bugs] [Boost C++ Libraries] #3249: ptr_list of const items
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-07-07 15:58:38

#3249: ptr_list of const items
 Reporter: matcatprg@… | Owner: nesotto
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: ptr_container
  Version: Boost 1.35.0 | Severity: Problem
 Keywords: |
 My code will not compile when I have a ptr_list of const abstract classes
 (i.e: boost::ptr_list<const abstract_class>). When I remove the const
 keyword, the code compiles and works fine. I'm using gcc 4.3 on Ubuntu

 Does the list need to be able to manipulate its items and therefore they
 can't be const? Or is it some bug? I noticed this line in the output:

 invalid conversion from ‘const void*’ to ‘void*’

 leading me to believe that it can't take consts. If it indeed can't take
 consts, you should mention it in the documentation or faq for

 Matthew A. Todd

 Here is the output from the compiler:

 /usr/include/boost/ptr_container/ptr_sequence_adapter.hpp: In member
 function ‘void boost::ptr_sequence_adapter<T, VoidPtrSeq,
 VoidPtrSeq>, CloneAllocator>::value_type) [with T = const BASE, VoidPtrSeq
 = std::list<void*, std::allocator<void*> >, CloneAllocator =
 main.cpp:42: instantiated from here
 /usr/include/boost/ptr_container/ptr_sequence_adapter.hpp:183: error:
 invalid conversion from ‘const void*’ to ‘void*’
 /usr/include/boost/ptr_container/ptr_sequence_adapter.hpp:183: error:
 initializing argument 1 of ‘void std::list<_Tp, _Alloc>::push_back(const
 _Tp&) [with _Tp = void*, _Alloc = std::allocator<void*>]’

Ticket URL: <https://svn.boost.org/trac/boost/ticket/3249>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC