Skip to content

Commit 640a8d8

Browse files
committed
Clang-tidy: add cppcoreguidelines-use-default-member-init
1 parent b8f5a4e commit 640a8d8

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

include/chinese/chinesePostman.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class PgrDirectedChPPGraph {
7070
void setPathEdges(graph::PgrCostFlowGraph &flowGraph);
7171

7272
private:
73-
int64_t totalDeg;
74-
double totalCost;
73+
int64_t totalDeg{0};
74+
double totalCost{0.0};
7575
int64_t superSource, superTarget;
7676
int64_t startPoint;
7777
double m_cost;
@@ -106,7 +106,7 @@ PgrDirectedChPPGraph::~PgrDirectedChPPGraph() {
106106
edgeToIdx.clear();
107107
}
108108
PgrDirectedChPPGraph::PgrDirectedChPPGraph(const std::vector<Edge_t> &dataEdges) :
109-
totalDeg(0), totalCost(0), vertices(),
109+
vertices(),
110110
edgeToIdx(), originalEdges(),
111111
resultGraph(), VToVecid(), edgeVisited(),
112112
pathStack(), resultPath(),

include/contraction/contractionGraph.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ class Pgr_contractionGraph : public Pgr_base_graph<G, CH_vertex, CH_edge, t_dire
6666
Prepares the _graph_ to be of type *directed*
6767
*/
6868
explicit Pgr_contractionGraph()
69-
: Pgr_base_graph<G, CH_vertex, CH_edge, t_directed>(),
70-
min_edge_id(0) {
69+
: Pgr_base_graph<G, CH_vertex, CH_edge, t_directed>() {
7170
}
7271

7372
/*! @brief get the vertex descriptors of adjacent vertices of *v*
@@ -549,7 +548,7 @@ class Pgr_contractionGraph : public Pgr_base_graph<G, CH_vertex, CH_edge, t_dire
549548
}
550549

551550
private:
552-
int64_t min_edge_id;
551+
int64_t min_edge_id = 0;
553552
Identifiers<V> forbiddenVertices;
554553
};
555554

include/vrp/solution.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Solution {
4646
friend class Optimize;
4747
friend class PD_problem;
4848
protected:
49-
double EPSILON;
49+
double EPSILON = 0.0001;
5050
std::deque<Vehicle_pickDeliver> fleet;
5151

5252
/* this solution belongs to this problem*/
@@ -66,7 +66,7 @@ class Solution {
6666

6767
/* @brief copy constructor */
6868
Solution(const Solution &sol) :
69-
EPSILON(0.0001),
69+
7070
fleet(sol.fleet),
7171
trucks(sol.trucks)
7272
{};

include/yen/ksp.hpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,8 @@ class Pgr_ksp : public Pgr_messages {
5858
typedef std::set<Path, compPathsLess> pSet;
5959

6060
public:
61-
Pgr_ksp() :
62-
m_start(0),
63-
m_end(0),
64-
m_K(0),
65-
m_heap_paths(false) {
61+
Pgr_ksp()
62+
{
6663
m_vis = new Visitor;
6764
}
6865
~Pgr_ksp() {
@@ -229,10 +226,10 @@ class Pgr_ksp : public Pgr_messages {
229226
///@{
230227
V v_source; //!< source descriptor
231228
V v_target; //!< target descriptor
232-
int64_t m_start; //!< source id
233-
int64_t m_end; //!< target id
234-
size_t m_K;
235-
bool m_heap_paths;
229+
int64_t m_start{0}; //!< source id
230+
int64_t m_end{0}; //!< target id
231+
size_t m_K{0};
232+
bool m_heap_paths{false};
236233

237234
Path curr_result_path; //!< storage for the current result
238235

src/pickDeliver/solution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Solution::get_kind() const {
230230
}
231231

232232
Solution::Solution() :
233-
EPSILON(0.0001),
233+
234234
trucks(problem->trucks()) {
235235
ENTERING(msg());
236236
for (const auto &t : trucks) {

0 commit comments

Comments
 (0)