Re: Does std::map provides a copy assignment operator?



Hashim Saleem wrote:
"Stephen Howe" wrote:

So far Hashim, we have not seen any code of yours.


So, here it is just for you guys. Actually, I cant post the source code as the policy of my company where I am doing job. I ll try to explain what I am doing by posting the code chunks. Hope these chunks would be enough to clear my situation here. :)
[SNIP]
Does your default constructor set m_pCert to NULL? What happens if CERT_DupCertificate fails? And are you sure it is correctly implemented?


Also, have you come across this style of operator== implementation:

A& operator=(A a) //parameter passed by value to create copy
{
  a.swap(*this);
  return *this; //a's destructor frees old members.
}

All you need to do is implement a swap function, and no need to check for self-assignment. And it is exception-safe, unlike your version.

Tom
.



Relevant Pages

  • Re: Source code security - rogue developers?
    ... >> How do larger software companies prevent any/all developers from ... >> making off with a full copy of the source code? ... > mechanisms to help support the policy. ... > understanding into your employment agreements so there can be no ...
    (comp.security.misc)
  • Re: Source code security - rogue developers?
    ... >> How do larger software companies prevent any/all developers from ... >> making off with a full copy of the source code? ... > mechanisms to help support the policy. ... > understanding into your employment agreements so there can be no ...
    (comp.security.misc)
  • Re: Moving to Linux
    ... it is very hard to find a company that does not have that policy. ... backup mail from some cow orkers. ... Source code is made out of people! ... You've gotta tell them. ...
    (alt.os.linux.suse)
  • Re: News: .NET framework source code available soon...
    ... Mads Bondo Dydensborg wrote: ... I do not recall writing anything about that, ... That's the inference I take from your statement regarding Mono's policy combined with your agreement with the policy. ... If you believe that there is no legal risk in creating similar source code as long as you haven't actually copied the .NET sources, then why is it that you think Mono's policy has merit? ...
    (microsoft.public.dotnet.languages.csharp)