"Terje Slettebø" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
> int main()
> {
> function_ptr fn;
>
> // The rest the same
>
> A a;
> int r=fn(&a, 3); // sets r to 9
> }
>
Is it similar (in principle) to
http://www.code-genie.com/cpp/articles/events/events.html (long
IMHO a very useful addon to your library can be routine
to convert class to function which calls class destructor.
template < typename T >
void destruct( void * buf )
{
reinterpret_cast(buf)->~T();
}
typedef void (*destruct_fn_type)( void * buf );
//like following, b
>From: "Pavel Vozenilek" <[EMAIL PROTECTED]>
> "Terje Slettebø" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> [snip]
>
> > int main()
> > {
> > function_ptr fn;
> >
> > // The rest the same
> >
> > A a;
> > int r=fn(&a, 3); // sets r to 9
> > }
> >
> Is it similar (in pri
>From: "Bohdan" <[EMAIL PROTECTED]>
> IMHO a very useful addon to your library can be routine
> to convert class to function which calls class destructor.
> //no virtual functions, no runtime polymorphism
> void * ptr = new MyClass;
> destruct_fn_type df = destruct_fn();