Re: [Boost-users] Boost-users Digest, Vol 2718, Issue 2

Or [as a 2nd thought], should I use it like below: - pass raw object pointer to callback fn. - in the callback ________________________________ From: "boost-users-request@lists.boost.org" <boost-users-request@lists.boost.org> To: boost-users@lists.boost.org Sent: Tuesday, 10 May 2011 4:32 PM Subject: Boost-users Digest, Vol 2718, Issue 2 Send Boost-users mailing list submissions to boost-users@lists.boost.org To subscribe or unsubscribe via the World Wide Web, visit http://lists.boost.org/mailman/listinfo.cgi/boost-users or, via email, send a message with subject or body 'help' to boost-users-request@lists.boost.org You can reach the person managing the list at boost-users-owner@lists.boost.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Boost-users digest..." Today's Topics: 1. Re: Boost-users Digest, Vol 2718, Issue 1 (Mupparthy Ravindranath) ---------------------------------------------------------------------- Message: 1 Date: Tue, 10 May 2011 16:32:28 +0530 (IST) From: Mupparthy Ravindranath <rv_nath@yahoo.com> To: "boost-users@lists.boost.org" <boost-users@lists.boost.org> Subject: Re: [Boost-users] Boost-users Digest, Vol 2718, Issue 1 Message-ID: <64558.18057.qm@web94805.mail.in2.yahoo.com> Content-Type: text/plain; charset="iso-8859-1" Actually, My intention is to pass a shared_ptr, as against a raw ptr.? The purpose is that after execting the callback, the shared_ptr can go out of scope, and ensure object deletion on its own, without having to call an explicit delete. So, I really wanted to pass a shared_ptr to the callback fn, as a void*. The reason behind this is... - i have a 3rd party timer engine, which accepts a callback function and callback args. - On timer expiry, it calls my regd callback implmentation, along with the args passed in its start_timer function. - Earlier, I was passing an object* to the callback args of the timer. - If the timer event fires, my callback impl gets called, and I get a chance to do a "delete", which is fine. - In some cases, I have to cancel / stop the timer.? And then since, my callback doesn't fire, I have no way to delete the obj*, and results in a memory leak. So, I wanted to pass a shared_ptr itself as the callback argument for my 3rd party timer. So that, even if timer doesn't fire, my object won't leak. regards, RV ________________________________ From: "boost-users-request@lists.boost.org" <boost-users-request@lists.boost.org> To: boost-users@lists.boost.org Sent: Tuesday, 10 May 2011 4:15 PM Subject: Boost-users Digest, Vol 2718, Issue 1 Send Boost-users mailing list submissions to ??? boost-users@lists.boost.org To subscribe or unsubscribe via the World Wide Web, visit ??? http://lists.boost.org/mailman/listinfo.cgi/boost-users or, via email, send a message with subject or body 'help' to ??? boost-users-request@lists.boost.org You can reach the person managing the list at ??? boost-users-owner@lists.boost.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Boost-users digest..." Today's Topics: ? 1. Re: Error: guid_defined is not ? ? ? templateBOOST_CLASS_EXPORT_GUID (Robert Ramey) ? 2. Re: [Boost][program-options] Original position of an??? argument ? ? ? in command-line. (Vladimir Prus) ? 3. How to cast a boost::shared_ptr to void* (Mupparthy Ravindranath) ? 4. Re: How to cast a boost::shared_ptr to void* (Robert Jones) ? 5. Re: How to cast a boost::shared_ptr to void* (michi7x7) ? 6. Re: How to cast a boost::shared_ptr to void* ? ? ? (Mupparthy Ravindranath) ? 7. Re: How to cast a boost::shared_ptr to void* (Robert Jones) ? 8. Re: [Boost][program-options] Original position of an argument ? ? ? in command-line. (Germ?n Diago) ---------------------------------------------------------------------- Message: 1 Date: Mon, 9 May 2011 21:57:06 -0800 From: "Robert Ramey" <ramey@rrsd.com> To: boost-users@lists.boost.org Subject: Re: [Boost-users] Error: guid_defined is not ??? templateBOOST_CLASS_EXPORT_GUID Message-ID: <iqagie$sbh$1@dough.gmane.org> Jari wrote:
... what does the code look like at line 162 of check.hpp ? Robert Ramey ------------------------------ Message: 2 Date: Tue, 10 May 2011 10:45:04 +0400 From: Vladimir Prus <vladimir@codesourcery.com> To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Boost][program-options] Original position ??? of an??? argument in command-line. Message-ID: <iqamtg$nvf$1@dough.gmane.org> Content-Type: text/plain; charset="UTF-8" Germ?n Diago wrote:
parse_command_line returns vector< basic_option<charT> >, which are in the order of occurence. This is a point where you can do logic based on the order. variables_map does not store order information. HTH, -- Vladimir Prus Mentor Graphics +7 (812) 677-68-40 ------------------------------ Message: 3 Date: Tue, 10 May 2011 13:26:09 +0530 (IST) From: Mupparthy Ravindranath <rv_nath@yahoo.com> To: "boost-users@lists.boost.org" <boost-users@lists.boost.org> Subject: [Boost-users] How to cast a boost::shared_ptr to void* Message-ID: <257490.53596.qm@web94803.mail.in2.yahoo.com> Content-Type: text/plain; charset="iso-8859-1" Hi all, My requirement is to cast an object of type shared_ptr as void*, so that I can send it to a callback function that accepts a void*.? I cannot change callback the function signature because it is part of an existing legacy code. In the existing code, I am sending a raw object pointer (instead of shared_ptr).? Now, if I want to pass a shared_ptr, it won't compile because I cannot cast the shared ptr to void*.? Can anyone suggest some workaround for this.? I tried searching the mailing lists and internet, but not much luck. regards, RV
participants (2)
-
Igor R
-
Mupparthy Ravindranath