Boost logo

Boost Users :

From: Duane Murphy (duanemurphy_at_[hidden])
Date: 2006-12-18 14:22:20


I'm trying to use boost::ptr_map<> and cannot get calls insert to compile.

I'm on Mac OS X using gcc 3.3 with Xcode.

Even the most basic code fails to compile:

        boost::ptr_map< in, int* > my_map;
        int * val = new int( 22 );
        my_map.insert( 1, val );

This fails with:

error: no matching function for call to `boost::ptr_map<int, int*,
std::less<int>, boost::heap_clone_allocator,
std::allocator<std::pair<const int, void*> > >::insert(int, int*&)'

error: candidates are: std::pair<typename
boost::ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap,
CloneAllocator>::iterator, bool> boost::ptr_map_adapter<T, VoidPtrMap,
CloneAllocator>::insert(typename boos
t::ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap,
CloneAllocator>::key_type&, typename
boost::ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap,
CloneAllocator>::value_type) [with T = int*, VoidPtrMap = std::map<int,
void*, std::less<int>, std::allocator<std::pair<const int, void*> > >,
CloneAllocator = boost::heap_clone_allocator]

This looks like it's recommending the function that should be working.
I've been poking at this for quite a while and cannot find a clue why
this is not working.

Thank you for the help,
 ...Duane

 ...Duane


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net