Skip to content

Commit f3553dc

Browse files
committed
clang-tidy: add cppcoreguidelines-special-member-functions
1 parent 5d76cc6 commit f3553dc

File tree

14 files changed

+90
-15
lines changed

14 files changed

+90
-15
lines changed

include/bdAstar/bdAstar.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ class Pgr_bdAstar : public Pgr_bidirectional<G> {
7979
}
8080

8181
~Pgr_bdAstar() = default;
82+
83+
Pgr_bdAstar(const Pgr_bdAstar&) = default;
84+
Pgr_bdAstar& operator=(const Pgr_bdAstar&) = default;
85+
Pgr_bdAstar(Pgr_bdAstar&&) = default;
86+
Pgr_bdAstar& operator=(Pgr_bdAstar&&) = default;
8287

8388
Path pgr_bdAstar(V start_vertex, V end_vertex,
8489
int heuristic,

include/bdDijkstra/bdDijkstra.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ class Pgr_bdDijkstra : public Pgr_bidirectional<G> {
7979

8080
~Pgr_bdDijkstra() = default;
8181

82+
Pgr_bdDijkstra(const Pgr_bdDijkstra&) = default;
83+
Pgr_bdDijkstra& operator=(const Pgr_bdDijkstra&) = default;
84+
Pgr_bdDijkstra(Pgr_bdDijkstra&&) = default;
85+
Pgr_bdDijkstra& operator=(Pgr_bdDijkstra&&) = default;
86+
8287
Path pgr_bdDijkstra(V start_vertex, V end_vertex, bool only_cost) {
8388
m_log << "pgr_bdDijkstra\n";
8489
v_source = start_vertex;

include/chinese/chinesePostman.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ class PgrDirectedChPPGraph {
6161
}
6262

6363
~PgrDirectedChPPGraph();
64+
65+
PgrDirectedChPPGraph(const PgrDirectedChPPGraph&) = delete;
66+
PgrDirectedChPPGraph& operator=(const PgrDirectedChPPGraph&) = delete;
67+
PgrDirectedChPPGraph(PgrDirectedChPPGraph&&) = delete;
68+
PgrDirectedChPPGraph& operator=(PgrDirectedChPPGraph&&) = delete;
6469

6570

6671
private:

include/cpp_common/assert.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ class AssertFailedException : public std::exception {
146146
virtual const char *what() const throw();
147147
explicit AssertFailedException(std::string msg);
148148
virtual ~AssertFailedException() throw() {}
149+
AssertFailedException(const AssertFailedException&) = delete;
150+
AssertFailedException& operator=(const AssertFailedException&) = delete;
151+
AssertFailedException(AssertFailedException&&) = delete;
152+
AssertFailedException& operator=(AssertFailedException&&) = delete;
153+
149154
};
150155

151156
#endif // INCLUDE_CPP_COMMON_ASSERT_HPP_

include/cpp_common/basic_vertex.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ class Basic_vertex {
5353

5454
Basic_vertex& operator=(const Basic_vertex&) = default;
5555

56+
Basic_vertex(Basic_vertex&&) = default;
57+
Basic_vertex& operator=(Basic_vertex&&) = default;
58+
~Basic_vertex() = default;
59+
5660
Basic_vertex(const Edge_t &other, bool is_source) :
5761
id(is_source? other.source : other.target) {}
5862

include/cpp_common/bidirectional.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ class Pgr_bidirectional {
7979
}
8080

8181
~Pgr_bidirectional() = default;
82+
83+
Pgr_bidirectional(const Pgr_bidirectional&) = default;
84+
Pgr_bidirectional& operator=(const Pgr_bidirectional&) = default;
85+
Pgr_bidirectional(Pgr_bidirectional&&) = default;
86+
Pgr_bidirectional& operator=(Pgr_bidirectional&&) = default;
8287

8388
std::string log() const {return m_log.str();}
8489
void clean_log() {m_log.clear();}

include/cpp_common/line_vertex.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ class Line_vertex {
6161
source(v.source),
6262
target(v.target),
6363
cost(v.cost) {}
64+
Line_vertex& operator=(const Line_vertex &v) {
65+
cp_members(v);
66+
return *this;
67+
}
68+
69+
70+
// Destructor
71+
~Line_vertex() = default;
72+
73+
// Delete move operations
74+
Line_vertex(Line_vertex&&) = delete;
75+
Line_vertex& operator=(Line_vertex&&) = delete;
76+
6477

6578
void cp_members(const Line_vertex &other) {
6679
this->id = other.id;

include/cpp_common/messages.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class Pgr_messages {
4040
Pgr_messages() = default;
4141
Pgr_messages(const Pgr_messages&) = delete;
4242
Pgr_messages& operator=(const Pgr_messages&) = delete;
43+
44+
~Pgr_messages() = default;
45+
46+
Pgr_messages(Pgr_messages&&) = delete;
47+
Pgr_messages& operator=(Pgr_messages&&) = delete;
4348

4449
/*! @brief get_log
4550
*

include/trsp/trspHandler.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ class TrspHandler : public pgrouting::Pgr_messages {
115115

116116
~TrspHandler(void) = default;
117117

118+
TrspHandler(const TrspHandler&) = delete;
119+
TrspHandler& operator=(const TrspHandler&) = delete;
120+
TrspHandler(TrspHandler&&) = delete;
121+
TrspHandler& operator=(TrspHandler&&) = delete;
122+
123+
118124
std::deque<Path> process(const std::map<int64_t, std::set<int64_t>>&);
119125

120126
void clear();

include/vrp/fleet.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ class Fleet {
6262
/*!@}*/
6363

6464
Fleet& operator=(const Fleet &fleet);
65+
~Fleet() = default; // add destructor
66+
Fleet(Fleet&&) noexcept = default; // enable move constructor
67+
Fleet& operator=(Fleet&&) noexcept = default; // enable move assignment
68+
6569

6670
void set_compatibles(const PD_Orders &orders);
6771

0 commit comments

Comments
 (0)