Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-11-15 15:36:10


--- Douglas Gregor <gregod_at_[hidden]> wrote:

[...]
> For reference, the address of an object can be retrieved without using
> the address-of operator with the following function template:
>
> template <typename T> T* addressof(T& v)
> {
> return reinterpret_cast<T*>(
> &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
> }
>
> Note: this relates directly to library issue 350, which will need to
> be reexamined if the CopyConstructible requirements change.
>
> Proposed resolution:
>
> Remove the last two rows of Table 30, eliminating the requirements
> that &t and &u return the address of t and u, respectively.

Thank you very much for your reply. The text confirmed what I suspected from
your previous words (suspect that is why I asked you to post the text itself),
i.e. that you prefer to drop any requirements on operator& instead of inventing
a separate concept (say "Addressable") for them. The problem I see in your
resolution is that AFAIK addressof() is not guaranteed to work by the standard.
Yes, it has an extremely high probability to do the right thing, but not a
guarantee. So I think either we find another portable way to take the address
or invent a new concept (which I like, though of course it requires more
changes to the standard)

Genny.

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com


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