Boost logo

Boost Users :

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


On Fri, Feb 6, 2009 at 9:55 AM, Robert Dailey <rcdailey_at_[hidden]> wrote:

> On Fri, Feb 6, 2009 at 9:03 AM, John Wilkinson <jwilkinson_at_[hidden]>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...



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