$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Christopher Harvey (arbuckle911_at_[hidden])
Date: 2008-06-12 12:45:41
This is a pretty simple question, so I'll just go ahead and paste the 
test case i wrote. The compile errors are right below it.
(boost version: 1.34.1-r2)
#include <utility>
#include <boost/ptr_container/ptr_map.hpp>
class Filter
{
public:
  virtual void blah() const = 0;
};
class SpecificFilter : public Filter
{
public:
  SpecificFilter() : Filter() {}
  void blah() const
  {
    
  }
};
int main()
{
  boost::ptr_map<unsigned char, Filter> map;
  map[0].blah();
}
/usr/include/boost/ptr_container/ptr_map_adapter.hpp: In member function 
'typename 
boost::ptr_container_detail::associative_ptr_container<boost::ptr_container_detail::map_config<T, 
VoidPtrMap>, CloneAllocator>::reference 
boost::ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, 
CloneAllocator>::insert_lookup(const typename 
boost::ptr_container_detail::associative_ptr_container<boost::ptr_container_detail::map_config<T, 
VoidPtrMap>, CloneAllocator>::key_type&) [with T = Filter, VoidPtrMap = 
std::map<unsigned char, void*, std::less<unsigned char>, 
std::allocator<std::pair<const unsigned char, void*> > >, CloneAllocator 
= boost::heap_clone_allocator]':
/usr/include/boost/ptr_container/ptr_map_adapter.hpp:268:   instantiated 
from 'typename 
boost::ptr_container_detail::associative_ptr_container<boost::ptr_container_detail::map_config<T, 
VoidPtrMap>, CloneAllocator>::reference 
boost::ptr_container_detail::ptr_map_adapter_base<T, VoidPtrMap, 
CloneAllocator>::operator[](const typename 
boost::ptr_container_detail::associative_ptr_container<boost::ptr_container_detail::map_config<T, 
VoidPtrMap>, CloneAllocator>::key_type&) [with T = Filter, VoidPtrMap = 
std::map<unsigned char, void*, std::less<unsigned char>, 
std::allocator<std::pair<const unsigned char, void*> > >, CloneAllocator 
= boost::heap_clone_allocator]'
main.cc:24:   instantiated from here
/usr/include/boost/ptr_container/ptr_map_adapter.hpp:168: error: cannot 
allocate an object of abstract type 'Filter'
main.cc:5: note:   because the following virtual functions are pure 
within 'Filter':
main.cc:7: note:     virtual void Filter::blah() const
I'm surprised it's not happy about the fact that blah is pure virtual 
because this is a pointer container so I thought that wouldn't be a 
problem.
Side note:
What happens when I try to access an element that doesn't exist, and 
what happens when I insert two elements with the same key?
Thanks for reading,
Chris.