#include
<
iostream
>
#include < boost / utility.hpp >
using namespace std;
class Object
{
public :
int i;
Object():i( 0x11223344 ){}
int operator & ()
{
return 0 ;
}
};
int main()
{
Object obj;
cout << & obj << endl;
Object * p = boost::addressof(obj);
Object * p1 = std::addressof(obj);
cout << p << endl;
cout << p1 << endl;
cout << hex << p -> i << endl;
cout << hex << p1 -> i << endl;
cin. get ();
}
#include < boost / utility.hpp >
using namespace std;
class Object
{
public :
int i;
Object():i( 0x11223344 ){}
int operator & ()
{
return 0 ;
}
};
int main()
{
Object obj;
cout << & obj << endl;
Object * p = boost::addressof(obj);
Object * p1 = std::addressof(obj);
cout << p << endl;
cout << p1 << endl;
cout << hex << p -> i << endl;
cout << hex << p1 -> i << endl;
cin. get ();
}