-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA13-5-4.cpp
More file actions
49 lines (37 loc) · 731 Bytes
/
A13-5-4.cpp
File metadata and controls
49 lines (37 loc) · 731 Bytes
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
// Rule: A13-5-4
// Source line: 20313
// Original file: A13-5-4.cpp
// $Id: A13-5-4.cpp 305629 2018-01-29 13:29:25Z piotr.serwa $
#include <cstdint>
//non-compliant
class A
{
public:
explicit A(std::uint32_t d) : d(d) {}
bool operator==(const A& rhs) const noexcept
{
return d == rhs.d;
}
bool operator!=(const A& rhs) const noexcept
{
return d != rhs.d;
}
private:
std::uint32_t d;
};
//compliant
class B
{
public:
explicit B(std::uint32_t d) : d(d) {}
bool operator==(const B& rhs) const noexcept
{
return d == rhs.d;
}
bool operator!=(const B& rhs) const noexcept
{
return !(*this==rhs);
}
private:
std::uint32_t d;
};