I'm using boost::bind to convert a function of the form: T::fun(boost::intrusive_ptr<U>) into a form which can be stored by boost::function.
Outputting calls to intrusive_ptr_add_ref and intrusive_ptr_release reveals there are a massive number of copies of the intrusive_ptr. For a single call of boost::bind on a
I'm wondering what kind of overhead this will add if I'm calling boost::bind on boost::intrusive_ptr a LOT of times? Will the copies be optimized out?
There are 6 calls to intrusive_ptr_add_ref when calling boost::bind to bind a member function pointer to an object which is wrapped up in an intrusive_ptr
There are 5 calls to intrusive_ptr_add_ref when calling boost::bind to bind an argument which is an intrusive_ptr
There are 12 calls to intrusive_ptr_add_ref when using boost::function to store the result of boost::bind when called to bind a member function pointer to an object which is wrapped up in an intrusive_ptr
There are 11 calls to intrusive_ptr_add_ref when using boost::function to store the result of boost::bind when called to bind an argument which is an intrusive_ptr
--------- creating intrusive ptr ----------
++ setting p (0x33b18)'s refs to 1
--------- binding intrusive_ptr object ----------
++ setting p (0x33b18)'s refs to 2
++ setting p (0x33b18)'s refs to 3
++ setting p (0x33b18)'s refs to 4
++ setting p (0x33b18)'s refs to 5
++ setting p (0x33b18)'s refs to 6
-- setting p (0x33b18)'s refs to 5
-- setting p (0x33b18)'s refs to 4
++ setting p (0x33b18)'s refs to 5
-- setting p (0x33b18)'s refs to 4
-- setting p (0x33b18)'s refs to 3
-- setting p (0x33b18)'s refs to 2
-- setting p (0x33b18)'s refs to 1
--------- now storing result of bind ----------
++ setting p (0x33b18)'s refs to 2
++ setting p (0x33b18)'s refs to 3
++ setting p (0x33b18)'s refs to 4
++ setting p (0x33b18)'s refs to 5
++ setting p (0x33b18)'s refs to 6
-- setting p (0x33b18)'s refs to 5
-- setting p (0x33b18)'s refs to 4
++ setting p (0x33b18)'s refs to 5
-- setting p (0x33b18)'s refs to 4
-- setting p (0x33b18)'s refs to 3
++ setting p (0x33b18)'s refs to 4
++ setting p (0x33b18)'s refs to 5
++ setting p (0x33b18)'s refs to 6
++ setting p (0x33b18)'s refs to 7
++ setting p (0x33b18)'s refs to 8
++ setting p (0x33b18)'s refs to 9
-- setting p (0x33b18)'s refs to 8
-- setting p (0x33b18)'s refs to 7
-- setting p (0x33b18)'s refs to 6
-- setting p (0x33b18)'s refs to 5
-- setting p (0x33b18)'s refs to 4
-- setting p (0x33b18)'s refs to 3
-- setting p (0x33b18)'s refs to 2
--------- binding intrusive_ptr object ----------
++ setting p (0x33b18)'s refs to 3
++ setting p (0x33b18)'s refs to 4
++ setting p (0x33b18)'s refs to 5
++ setting p (0x33b18)'s refs to 6
-- setting p (0x33b18)'s refs to 5
++ setting p (0x33b18)'s refs to 6
-- setting p (0x33b18)'s refs to 5
-- setting p (0x33b18)'s refs to 4
-- setting p (0x33b18)'s refs to 3
-- setting p (0x33b18)'s refs to 2
--------- now storing result of bind ----------
++ setting p (0x33b18)'s refs to 3
++ setting p (0x33b18)'s refs to 4
++ setting p (0x33b18)'s refs to 5
++ setting p (0x33b18)'s refs to 6
-- setting p (0x33b18)'s refs to 5
++ setting p (0x33b18)'s refs to 6
-- setting p (0x33b18)'s refs to 5
-- setting p (0x33b18)'s refs to 4
++ setting p (0x33b18)'s refs to 5
++ setting p (0x33b18)'s refs to 6
++ setting p (0x33b18)'s refs to 7
++ setting p (0x33b18)'s refs to 8
++ setting p (0x33b18)'s refs to 9
++ setting p (0x33b18)'s refs to 10
-- setting p (0x33b18)'s refs to 9
-- setting p (0x33b18)'s refs to 8
-- setting p (0x33b18)'s refs to 7
-- setting p (0x33b18)'s refs to 6
-- setting p (0x33b18)'s refs to 5
-- setting p (0x33b18)'s refs to 4
-- setting p (0x33b18)'s refs to 3
-- setting p (0x33b18)'s refs to 2
-- setting p (0x33b18)'s refs to 1
-- setting p (0x33b18)'s refs to 0