
Markus Schöpflin skrev:
Hello,
currently these tests fail with
"../boost/ptr_container/ptr_set_adapter.hpp", line 362: error #2309: more than one instance of constructor "boost::ptr_container_detail::ptr_set_adapter_base<Key, VoidPtrSet, CloneAllocator, Ordered>::ptr_set_adapter_base [with Key=Base, VoidPtrSet=std::set<void *, boost::void_ptr_indirect_fun<std::less<Base>, Base, Base>, std::allocator<void *>>, CloneAllocator=boost::heap_clone_allocator, Ordered=true]" matches the argument list: function template "boost::ptr_container_detail::ptr_set_adapter_base<Key, VoidPtrSet, CloneAllocator, Ordered>::ptr_set_adapter_base(const Compare &, const Allocator &) [with Key=Base, VoidPtrSet=std::set<void *, boost::void_ptr_indirect_fun<std::less<Base>, Base, Base>, std::allocator<void *>>, CloneAllocator=boost::heap_clone_allocator, Ordered=true]" function template "boost::ptr_container_detail::ptr_set_adapter_base<Key, VoidPtrSet, CloneAllocator, Ordered>::ptr_set_adapter_base(InputIterator, InputIterator) [with Key=Base, VoidPtrSet=std::set<void *, boost::void_ptr_indirect_fun<std::less<Base>, Base, Base>, std::allocator<void *>>, CloneAllocator=boost::heap_clone_allocator, Ordered=true]" argument types are: (boost::void_ptr_iterator<__rw::__rw_tree_iter<void *, ptrdiff_t, void *const *, void *const &, __rw::__rw_rb_tree_node<std::allocator<void *>, void *, void *, __rw::__ident<void *, void *>>>, Base>, boost::void_ptr_iterator<__rw::__rw_tree_iter<void *, ptrdiff_t, void *const *, void *const &, __rw::__rw_rb_tree_node<std::allocator<void *>, void *, void *, __rw::__ident<void *, void *>>>, Base>) : base_type( first, last )
The compilers has difficulties choosing between:
template< class Compare, class Allocator > ptr_set_adapter_base( const Compare& comp, const Allocator& a )
and
template< class InputIterator > ptr_set_adapter_base( InputIterator first, InputIterator last )
Interestingly, if I just remove the following constructors, these tests pass for me on Cxx, and no other failures are introduced.
template< class Compare, class Allocator > ptr_set_adapter_base( const Compare& comp, const Allocator& a )
template< class Compare, class Allocator > associative_ptr_container( const Compare& comp, const Allocator& a )
So are these constructors needed at all?
I don't think I have a test that sets the allocator and the comparison predicate in the constructor. But I'll admit that passing all the constructor arguments is quite irritating when you need to support 4 or 5 different types of containers. I've removed the two other functions, because the one with two template arguments is more general. It's committed to trunk, so let's see how it goes. Thanks -Thorsten