blob: 1821564d3aa606e4ea9bf56608c6ba9645e4ded4 (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
struct ValueClass // OK
{
int m;
};
struct DerivedValueClass : public ValueClass // OK
{
int m;
};
struct PolymorphicClass1 // OK, not copyable
{
virtual void foo();
PolymorphicClass1(const PolymorphicClass1 &) = delete;
PolymorphicClass1& operator=(const PolymorphicClass1 &) = delete;
};
struct PolymorphicClass2 // OK, not copyable
{
virtual void foo();
private:
PolymorphicClass2(const PolymorphicClass2 &);
PolymorphicClass2& operator=(const PolymorphicClass2 &);
};
struct PolymorphicClass3 // OK, not copyable
{
virtual void foo();
PolymorphicClass3(const PolymorphicClass3 &) = delete;
private:
PolymorphicClass3& operator=(const PolymorphicClass3 &) = delete;
};
struct PolymorphicClass4 // Warning, copyable
{
virtual void foo();
PolymorphicClass4(const PolymorphicClass4 &);
PolymorphicClass4& operator=(const PolymorphicClass4 &);
Q_DISABLE_COPY(PolymorphicClass4)
};
struct PolymorphicClass5 // Warning, copyable
{
public:
PolymorphicClass5() = default;
virtual void foo();
Q_DISABLE_COPY(PolymorphicClass5)
};
struct DerivedFromNotCopyable : public PolymorphicClass3 // OK, not copyable
{
};
struct DerivedFromCopyable : public PolymorphicClass4 // Warning, copyable
{
public:
DerivedFromCopyable() = default;
Q_DISABLE_COPY(DerivedFromCopyable)
};
class ClassWithPrivateSection
{
public:
ClassWithPrivateSection() = default;
virtual void foo();
private:
Q_DISABLE_COPY(ClassWithPrivateSection)
void bar();
int i;
};
|