I am came across a question Which is better i++
or ++i
.
Somebody said ++i
as it does not require copy c-or . I just want to know what is a copy c-or and is it a disadvantage to use such a thing ?
Asked
Active
Viewed 173 times
2
-
*c-or* stands for *constructor* and implies C++ rather than C. – NPE Feb 27 '12 at 16:42
-
3This is not a duplicate; the question is, "What is a copy c-or?" This hasn't been asked before. According to Google, there is no mention of "copy c-or" in any other question on SO. While "copy c-or" doesn't seem to be commonly used when discussing C++, the OP probably *meant* to ask, "What is a copy **ctor**?" While that probably *would* be a duplicate, it's not a duplicate of the questions shown here. – Dan Moulding Feb 27 '12 at 16:48
-
@DanMoulding Ya i totally agree ... – Invictus Feb 27 '12 at 17:00
-
1Please provide a link to the question. I cannot find a question with the quoted title, and Google doesn't show any other questions with the term *copy c-or*. – Rob Kennedy Feb 27 '12 at 17:20
-
Lesson to be learned from this: **duplicate** *doo' - pli - kit* (n.) 1. a copy exactly like an original. 2. anything corresponding in all respects to something else. Having a different key term in the question title does not make a similar question into a duplicate! – Platinum Azure Feb 27 '12 at 17:36
1 Answers
6
Both "copy c-or" and "copy ctor" refer to the "copy constructor", which essentially refers to the object having to be copied.
The reason for this is that the post-increment operator increments the object in question, but also returns the original object in the expression, necessitating a copy.

Platinum Azure
- 45,269
- 12
- 110
- 134