> From: William E. Kempf [mailto:williamkempf@hotmail.com]
> Sent: 06 August 2002 19:17

> From: "Peter Dimov" <pdimov@mmltd.net>
> Sent: Tuesday, August 06, 2002 12:42 PM

> > References would need to be converted temporarily to
> pointers, but _seems_
> > possible.
>
> Through black magic, yeah ;).  I can try and see if I can
> devise a solution
> here, though I'm not sure I've got the expertise to do so.

For a reference type RT&:

const volatile char* r; // as a data member

// to call the function and capture the return
// add max cv-qualification to avoid having to know it
r=&reinterpret_cast<const volatile char&>(f());

// to return the value
// cast back to an appropriate type with max cv-qualification
// then return to original cv-qualification
return const_cast<RT&>(reinterpret_cast<const volatile RT&>(*r));

Anthony