Try commenting out the textures.find line - I think that you will still
get the error. It's the returned pointer that is the problem.
John
________________________________
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Robert Dailey
Sent: Friday, February 06, 2009 10:06 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [ptr_container] ptr_map and cloning issues
On Fri, Feb 6, 2009 at 9:55 AM, Robert Dailey
wrote:
On Fri, Feb 6, 2009 at 9:03 AM, John Wilkinson
wrote:
It's the commented-out code that will not compile. When the instance of
MapType goes out of scope, the type of the contained pointers cannot be
unknown, because they have to be deleted.
My specific issue isn't about scope, it's strictly usage of a reference.
I know for a fact that the container is not being destroyed at this
specific area of code. Below is what I'm actually doing:
static Texture const* FindTexture( std::string const& textureId,
TextureContainer const& textures )
{
TextureContainer::const_iterator it = textures.find( textureId
);
if( it == textures.end() )
{
/// @todo Throw an exception here?
assert(0);
}
return it->second;
}
And since the error message is so long I've placed that in a text file
and attached that to this email. If there's anything else I can provide
I'd be happy to. I have no leads on what this error could mean. I wish
it wasn't so cryptic.
When I provide the full class definition (versus the forward
declaration), it still fails because class Texture is
boost::noncopyable. Why is ptr_map::find() trying to copy construct a
Texture? This shouldn't be happening...