Opened 11 years ago
Last modified 9 years ago
#6611 new Bugs
boost::pool_allocator construct() with single argument required by GCC 4.6 stl
Reported by: | Owned by: | Chris Newbold | |
---|---|---|---|
Milestone: | To Be Determined | Component: | pool |
Version: | Boost 1.51.0 | Severity: | Problem |
Keywords: | pool_allocator construct | Cc: | lars.kyllingstad@… |
Description
I tried to compile a MSVC code using custom std::vector/pool_allocator under win32/codeblocks (which uses GCC 4.6.0), and I get an error because on vector::resize() and underlying call _ _ uninitialized_default_a(), the stl implemented try to call _ _ alloc.construct() with a single placement address as argument.
The thing is that boost:pool_allocator provides only one version of construct() which takes 2 arguments. Why isn't a "default" construct( const pointer& ) implemented in pool_allocator ? Or why this version of the stl implements that ? Or what am I doing wrong ?
Thanks
Change History (4)
comment:1 by , 10 years ago
Component: | None → pool |
---|---|
Owner: | set to |
comment:2 by , 10 years ago
Cc: | added |
---|---|
Type: | Support Requests → Bugs |
Version: | Boost 1.48.0 → Boost 1.51.0 |
I have run into the same problem when using the std::list constructor which only takes the list size. Here is a test case:
#include <list> #include <boost/pool/pool_alloc.hpp> void foo() { typedef boost::fast_pool_allocator<int> Alloc; std::list<int, Alloc> myList(3); }
Compiled with GCC 4.6.1 using -std=c++0x
and Boost 1.51.0, this results in the following errors:
/usr/include/c++/4.6/bits/stl_list.h: In member function ‘std::list<_Tp, _Alloc>::_Node* std::list<_Tp, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {}, _Tp = int, _Alloc = boost::fast_pool_allocator<int>, std::list<_Tp, _Alloc>::_Node = std::_List_node<int>]’: /usr/include/c++/4.6/bits/stl_list.h:1523:63: instantiated from ‘void std::list<_Tp, _Alloc>::_M_insert(std::list<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {}, _Tp = int, _Alloc = boost::fast_pool_allocator<int>, std::list<_Tp, _Alloc>::iterator = std::_List_iterator<int>]’ /usr/include/c++/4.6/bits/stl_list.h:998:11: instantiated from ‘void std::list<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {}, _Tp = int, _Alloc = boost::fast_pool_allocator<int>]’ /usr/include/c++/4.6/bits/stl_list.h:1474:4: instantiated from ‘void std::list<_Tp, _Alloc>::_M_default_initialize(std::list<_Tp, _Alloc>::size_type) [with _Tp = int, _Alloc = boost::fast_pool_allocator<int>, std::list<_Tp, _Alloc>::size_type = unsigned int]’ /usr/include/c++/4.6/bits/stl_list.h:534:9: instantiated from ‘std::list<_Tp, _Alloc>::list(std::list<_Tp, _Alloc>::size_type) [with _Tp = int, _Alloc = boost::fast_pool_allocator<int>, std::list<_Tp, _Alloc>::size_type = unsigned int]’ a.cpp:7:35: instantiated from here /usr/include/c++/4.6/bits/stl_list.h:494:8: error: no matching function for call to ‘boost::fast_pool_allocator<std::_List_node<int>, boost::default_user_allocator_new_delete, boost::mutex, 32u, 0u>::construct(std::list<int, boost::fast_pool_allocator<int> >::_Node*&)’ /usr/include/c++/4.6/bits/stl_list.h:494:8: note: candidate is: /home/larky/.local/include/boost/pool/pool_alloc.hpp:398:10: note: void boost::fast_pool_allocator<T, UserAllocator, Mutex, NextSize, MaxSize>::construct(boost::fast_pool_allocator<T, UserAllocator, Mutex, NextSize, MaxSize>::pointer, const value_type&) [with T = std::_List_node<int>, UserAllocator = boost::default_user_allocator_new_delete, Mutex = boost::mutex, unsigned int NextSize = 32u, unsigned int MaxSize = 0u, boost::fast_pool_allocator<T, UserAllocator, Mutex, NextSize, MaxSize>::pointer = std::_List_node<int>*, boost::fast_pool_allocator<T, UserAllocator, Mutex, NextSize, MaxSize>::value_type = std::_List_node<int>] /home/larky/.local/include/boost/pool/pool_alloc.hpp:398:10: note: candidate expects 2 arguments, 1 provided
I have changed the ticket type to "Bugs", since this version of Boost claims to support C++11 mode in GCC 4.6.
Please set the component in the future if you want it to be analyzed.