Jump to content
  • Advertisement
Sign in to follow this  
Dragon_Strike

boost::intrusive_ptr wrapper

This topic is 3915 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

i would like to create a class wrapper for boost::intrusive_ptr which just ads a few function id like... it shold work just like intrusive_ptr just with these extra functions... is this possible? im having problem getting it working with the constructors... something like template<class T> class new_ptr : public boost::intrusive_ptr<T> { public: void NewFunction(){} }

Share this post


Link to post
Share on other sites
Advertisement
It's certainly possible.

Quote:
Original post by Dragon_Strike
im having problem getting it working with the constructors...

Could you be a little more specific?

Share this post


Link to post
Share on other sites
well i dont know how to be very specific...
i get alot of different compiler errors that has to do with the templates...
ill be more specific once i get home from my job...

try to compile a similar class and you'll see...

is there anyway to derive both public and private?

Share this post


Link to post
Share on other sites
Quote:

Original post by Dragon_Strike
well i dont know how to be very specific...


Listing the code that doesn't work might be a good start. [smile]

Share this post


Link to post
Share on other sites
I thought id post here since i had no idea how to derive intrusive_ptr properly...

i was hoping that someone just showed me how to implement the constructor... but on second thought that might be hard if i dont understand what i want to do...

ill make another try and post the code and errors this time...

ill be back later 2 day with that... thx

Share this post


Link to post
Share on other sites
Don't derive from boost::intrusive_ptr. It lacks a virtual destructor, meaning it isn't intended to be derived from. Use non-member functions if you want extra functionality.

Share this post


Link to post
Share on other sites
Quote:
then instead of writing a wrapper ill just rewrite the entire intrusive_ptr source code...


That's not what SiCrane suggested. He meant the if you want to implement extra functionality, you can do so with non-member functions. There's really no need to completely rewrite the class.

Share this post


Link to post
Share on other sites
Quote:

ok thx...
then instead of writing a wrapper ill just rewrite the entire intrusive_ptr source code...

That would be silly, wouldn't it?

What function do you want to add, and why? Either there is a better way to accomplish what you want without re-engineering an entire (rather complex) pointer class, or what you want to do is a bad idea anyway and you should find another way to do it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dragon_Strike
ok thx...
then instead of writing a wrapper ill just rewrite the entire intrusive_ptr source code...
Hm, that doesn't sound like a particularly good idea - it'll consume time and effort probably better spent elsewhere, and may very well leave you with buggy code (remember that the Boost libraries are widely used and have been thoroughly reviewed and tested).

What extra functionality do you want to add?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!