Boost logo

Boost Users :

From: Oleg Smolsky (oleg.smolsky_at_[hidden])
Date: 2005-10-24 17:38:27


Hi all,

I've just started looking at ptr_vector<> and got stuck on the
following issue:

        putting a boost::ptr_vector<Simple> into a map doesn't
        compile. See the following test case:

class Simple
{
public:
        virtual ~Simple()
        {
        }
        void foo()
        {
                doFoo();
        }
    
protected:
        virtual void doFoo()
        {
        }
};

void Test()
{
        std::map<std::string, boost::ptr_vector<Simple> > map;
        map["key"].push_back(new Simple);
}

I'm using VS2005 RC1 (8.0.50727.26) and the compiler output is as
follows:

1>c:\work\3rd-party\boost\include\boost-1_33\boost/ptr_container/ptr_sequence_adapter.hpp(595) : error C2248: 'boost::ptr_container_detail::reversible_ptr_container<Config,CloneAllocator>::reversible_ptr_container' : cannot access private member declared in class 'boost::ptr_container_detail::reversible_ptr_container<Config,CloneAllocator>'
1> with
1> [
1> Config=boost::ptr_container_detail::sequence_config<Simple,std::vector<void *,std::allocator<void *>>>,
1> CloneAllocator=boost::heap_clone_allocator
1> ]
1> c:\work\3rd-party\boost\include\boost-1_33\boost/ptr_container/detail/reversible_ptr_container.hpp(294) : see declaration of 'boost::ptr_container_detail::reversible_ptr_container<Config,CloneAllocator>::reversible_ptr_container'
1> with
1> [
1> Config=boost::ptr_container_detail::sequence_config<Simple,std::vector<void *,std::allocator<void *>>>,
1> CloneAllocator=boost::heap_clone_allocator
1> ]
1> This diagnostic occurred in the compiler generated function 'boost::ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>::ptr_sequence_adapter(const boost::ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator> &)'
1> with
1> [
1> T=Simple,
1> VoidPtrSeq=std::vector<void *,std::allocator<void *>>,
1> CloneAllocator=boost::heap_clone_allocator
1> ]

Can anybody shed some light on the subject?

Thanks,
Oleg.


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