473,385 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Bypass the overload of the address-of operator


I can recall a little trick for getting the address of an object and
bypassing any user-defined overload of the addressof operator. I think it
was something like:

T *p = reinterpret_cast<T*>( &reinterpret_cast<char&>(obj) );

Is that it exactly, or are people using something else?

--
Tomás Ó hÉilidhe
Jan 15 '08 #1
1 2320
Tomás Ó hÉilidhe wrote:
>
I can recall a little trick for getting the address of an object and
bypassing any user-defined overload of the addressof operator. I think it
was something like:

T *p = reinterpret_cast<T*>( &reinterpret_cast<char&>(obj) );

Is that it exactly, or are people using something else?
Almost:

// stolen from Boost:
template < typename T >
T * address_of (T & t) {
return (
reinterpret_cast<T*>(
& const_cast<char&>(
reinterpret_cast<const volatile char &>( t ) ) ) );
}

Best

Kai-Uwe Bux
Jan 15 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: V.Boomessh | last post by:
Hai all can any one help me in the following issue with crystal reports for VS.NET Each and every time i run the report i get the SQL server login screen to get the password. Can i bypass this...
13
by: Tony Johansson | last post by:
Hello! I just wonder if it's possible to overload a method only by having a different return type. //Tony
2
by: Mike | last post by:
Hi, I need to disable the Shift Key ByPass in an Acceess 2002 database. Can anyone give me some advice regarding how I can do this? Mike
3
by: hebandgene | last post by:
When I delete a record in a subform I get the warning that I'm about to delete a record, followed by an error "No current record." When I click OK obviously the record is deleted and it goes to...
2
by: Mahesh Devjibhai Dhola | last post by:
Can you please help me in my problem? I have a socket prog. application like http://www.codeproject.com/dotnet/csharpwhiteboard.asp My application is chat application like above architecture....
10
by: Parth | last post by:
Hello everyone, I need some help regrading byassing firewalls.My college has internet aces but it prevents us from dowloading music(*.mp3,*.mid,etc.)from the net.I use a win xp sp2 and browse...
0
by: teddysnips | last post by:
My client's system is ASP.NET over intranet/internet. Currently the system uses session cookies, so the user has to log in anew every time they close the browser. They have asked me if I can...
2
by: Chumma Dede | last post by:
Hi, I have a page called Page1.aspx on an ASP.Net 1.1 website which has Forms Authentication enabled. Role1 has been setup in the Web.config to have access to Page1.aspx as follows:...
1
by: OlaPihl | last post by:
Hi, How can I by code enable and disable "Bypass proxy server for local adresses" in Internet Explorer / Tools / Internet Options / Connections / LAN Settings. I have made a program (VB.Net)...
2
by: zbigniew | last post by:
Can someone explain me how overload resolution works in C++? For example if I have function void f(char, int); and I will call f('A', 3.1) or f(1.5, 3.1F) what would be the result? Thanks
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.