Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Address of a string
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Kai-Uwe Bux, post: 2573524"] Rarely, but keep in mind that operator& is overloadable. So, when you have a function foo ( T* ptr ); and you call it like foo(&obj), it could happen that the compiler complains that &obj is not of type T* even though obj is of type T. I think so. The boost version runs (essentially) like this: template <typename T> T* addressof ( T & v ) { return reinterpret_cast<T*>( &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); } I never quite understood why they put in the const volatile just to cast ways the constness in the very next step. Best Kai-Uwe Bux [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Address of a string
Top