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++
Does assignment operator have to behave exactly like copy constructor
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="Victor Bazarov, post: 1547388"] To determine whether some decision (design decision included) is bad or good, one needs to know the motivation behind the decision. Why do you think you need them to behave differently? The copy-construction or copy-assignment have the "copy" as their key word. You implement them both. So, you must have a compelling reason to make them different, otherwise, if you asked a lay person, they'd just say, "Hey, you're making a copy either way, right? So, it should be the same thing." If your goal is to implement "lazy copying" or "copy-on-write" sort of thing, then both should essentially do it, and you need to employ some variation of reference counting. If that's not your goal, then what? V [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Does assignment operator have to behave exactly like copy constructor
Top