forked from CaptGreg/SenecaOOP345-attic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copyelision.cpp
48 lines (35 loc) · 952 Bytes
/
copyelision.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// http://definedbehavior.blogspot.ca/2011/08/value-semantics-copy-elision.html
// elision
// noun
// 1The omission of a sound or syllable when speaking (as in I’m, let’s): the shortening of words by elision [count noun]: conversational elisions
// 1.1 [count noun] An omission of a passage in a book, speech, or film: the movie’s elisions and distortions have been carefully thought out
// 2The process of joining together or merging things, especially abstract ideas: unease at the elision of so many vital questions
#include <iostream>
using namespace std;
typedef double type;
void f( type arg ) {
std::cout << arg << "\n";
}
type g() {
return type();
}
void g1( type const & ref )
{
}
void g2( type arg )
{
type copy(arg);
// operate on copy // operate on arg
}
type f2() {
return type();
}
type g3( type arg ) {
return arg;
}
int main() {
type x;
f( x );
type const & ref = g();
type x2 = g3( f2() );
}