Boost logo

Boost Users :

Subject: [Boost-users] [ptr_container] ptr_map and cloning issues
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2009-02-06 01:23:25


I have a ptr_map as follows:

typedef boost::ptr_map<std::string, Texture> TextureContainer;

I only use forward declarations of Texture where needed. When I'm iterating
over an instance of TextureContainer, I expect to not have to do more than
use the forward declaration since technically we're only iterating pointer
values and the definition of Texture is not needed for this. So when I do
this:

TextureContainer myTextures;
TextureContainer::const_iterator it = myTextures.find( "some key" );

The above (second line) results in an extremely complex and long compiler
error, but the important part of the error says what I have pasted below.
Why is this error happening? Is it trying to clone Texture objects? This
shouldn't be happening.

*boost/ptr_container/clone_allocator.hpp(34) : error C2514: 'rs::Texture' :
class has no constructors
        C:\IT\work\planb\components\rs/renderer/TextureFwd.hpp(6) : see
declaration of 'rs::Texture'

C:\IT\work\planb\third_party\boost\1_37_0\boost/ptr_container/clone_allocator.hpp(55)
: see reference to function template instantiation 'T
*boost::new_clone<U>(const T &)' being compiled*



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