Jump to content
  • Advertisement
Sign in to follow this  
lephyrius

Boost flyweight trouble

This topic is 3495 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

As you may have seen I try to use boost flyweight but it only gives me: " Assertion failed: (count()<=1), function ~refcounted_value, file /boost_1_39_0/boost/flyweight/refcounted.hpp, line 70. " I use Xcode on OS X to compile for iPhone. But here is what im doing: (really damn downstripped)
class Model {
public:

boost::flyweight<boost::flyweights::key_value<String,Texture,TextureNameExtractor> >** pages;
};


Model::Model() {

pages = new boost::flyweight<boost::flyweights::key_value<String,Texture,TextureNameExtractor> >* [1];

pages[0] = new boost::flyweight<boost::flyweights::key_value<String,Texture,TextureNameExtractor> > ("CoolModel");
}



I also tried with:
std::vector< boost::flyweight<boost::flyweights::key_value<String,Texture,TextureNameExtractor> > > pages;


But same result. Where do the destructor get called?

Share this post


Link to post
Share on other sites
Advertisement
You've got pointers and other evil things, it's likely you did something wrong.

Write a testcase: the least amount of code that exhibits the problem with your original code. That means we can take your paste and pass it to a compiler.

Share this post


Link to post
Share on other sites
Quote:
Original post by loufoque
You've got pointers and other evil things, it's likely you did something wrong.

Write a testcase: the least amount of code that exhibits the problem with your original code. That means we can take your paste and pass it to a compiler.


I hate myself and I feel ashamed. When I wrote the testcase I discovered something in the constructor.

Model::Model() : pages(NULL) { }

That was the cause of the problem. I really don't know why but when I removed pages(NULL) it worked perfectly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!