FairRoot
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
cxx11-test-rvalue-references.cpp
Go to the documentation of this file.
1
#include <cassert>
2
3
class
rvmove
{
4
public
:
5
void
*
ptr
;
6
char
*
array
;
7
8
rvmove
()
9
:
ptr
(0),
10
array
(new char[10])
11
{
12
ptr
=
this
;
13
}
14
15
rvmove
(
rvmove
&&other)
16
:
ptr
(other.
ptr
),
17
array
(other.
array
)
18
{
19
other.array = 0;
20
other.ptr = 0;
21
}
22
23
~rvmove
()
24
{
25
assert(((
ptr
!= 0) && (
array
!= 0)) || ((
ptr
== 0) && (
array
== 0)));
26
delete
[]
array
;
27
}
28
29
rvmove
&
operator=
(
rvmove
&&other)
30
{
31
delete
[]
array
;
32
ptr
= other.ptr;
33
array
= other.array;
34
other.array = 0;
35
other.ptr = 0;
36
return
*
this
;
37
}
38
39
static
rvmove
create
()
40
{
41
return
rvmove
();
42
}
43
private
:
44
rvmove
(
const
rvmove
&);
45
rvmove
&
operator=
(
const
rvmove
&);
46
};
47
48
int
main
()
49
{
50
rvmove
mine;
51
if
(mine.
ptr
!= &mine)
52
return
1;
53
mine =
rvmove::create
();
54
if
(mine.
ptr
== &mine)
55
return
1;
56
return
0;
57
}
rvmove::ptr
void * ptr
Definition:
cxx11-test-rvalue-references.cpp:5
rvmove::create
static rvmove create()
Definition:
cxx11-test-rvalue-references.cpp:39
rvmove
Definition:
cxx11-test-rvalue-references.cpp:3
rvmove::rvmove
rvmove()
Definition:
cxx11-test-rvalue-references.cpp:8
rvmove::operator=
rvmove & operator=(rvmove &&other)
Definition:
cxx11-test-rvalue-references.cpp:29
main
int main(void)
Definition:
cxx11-test-__func__.cpp:1
rvmove::array
char * array
Definition:
cxx11-test-rvalue-references.cpp:6
rvmove::~rvmove
~rvmove()
Definition:
cxx11-test-rvalue-references.cpp:23
rvmove::rvmove
rvmove(rvmove &&other)
Definition:
cxx11-test-rvalue-references.cpp:15
FairRoot
cmake
checks
cxx11-test-rvalue-references.cpp
Generated on Mon Mar 8 2021 12:14:05 for FairRoot by
1.8.5