Boost logo

Boost :

From: Anthony Williams (anthwil_at_[hidden])
Date: 2002-08-07 03:11:52


> From: William E. Kempf [mailto:williamkempf_at_[hidden]]
> Sent: 06 August 2002 19:17

> From: "Peter Dimov" <pdimov_at_[hidden]>
> 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



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk