------------------------------
Message: 6
Date: Tue, 10 May 2011 14:24:26 +0530 (IST)
From: Mupparthy Ravindranath
To: "boost-users@lists.boost.org"
Subject: Re: [Boost-users] How to cast a boost::shared_ptr to void*
Message-ID: <443447.3562.qm@web94809.mail.in2.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"
Sorry for the spam.? I got the answer, how to do it. Ignore my previous mail.
[quote]
#include
#include <iostream>
using namespace std;
class A {
??? public:
??? void hello () { cout << "Hello, friends...!" << endl; }
};
typedef boost::shared_ptr<A> APtr;
void* callbk (void* o) {
??? APtr a = *static_cast(o);
??? a->hello();
}
int main() {
A* rawPtr = new A;
boost::shared_ptr<A>sPtr(rawPtr);
callbk((void*)&sPtr);
return 0;
}
[/quote]
warm regars,
RV