Skip to content

Commit 4a5b811

Browse files
committed
clang-tidy: fix cppcoreguidelines-pro-type-member-init
1 parent e06c177 commit 4a5b811

File tree

17 files changed

+50
-51
lines changed

17 files changed

+50
-51
lines changed

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Checks: >
1818
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
1919
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
2020
-cppcoreguidelines-pro-type-const-cast,
21-
-cppcoreguidelines-pro-type-member-init,
2221
-cppcoreguidelines-pro-type-reinterpret-cast,
2322
-cppcoreguidelines-pro-type-union-access,
2423
-cppcoreguidelines-pro-type-vararg,

include/chinese/chinesePostman.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ PgrDirectedChPPGraph::PgrDirectedChPPGraph(const std::vector<Edge_t> &dataEdges)
160160
}
161161
}
162162

163-
CostFlow_t edge;
163+
CostFlow_t edge{};
164164
edge.edge_id = e.id;
165165
edge.reverse_capacity = -1;
166166
edge.reverse_cost = -1.0;
@@ -185,7 +185,7 @@ PgrDirectedChPPGraph::PgrDirectedChPPGraph(const std::vector<Edge_t> &dataEdges)
185185
int d = iter->second;
186186
if (d == 0) continue;
187187
if (d > 0) totalDeg += d;
188-
CostFlow_t edge = {};
188+
CostFlow_t edge{};
189189
edge.reverse_capacity = -1;
190190
edge.reverse_cost = -1.0;
191191
edge.cost = 0.0;

include/cpp_common/base_graph.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ class Pgr_base_graph {
720720
* @return edge data
721721
*/
722722
T_E get_edge_info(const E &e) const {
723-
T_E d_edge;
723+
T_E d_edge{};
724724
d_edge.id = graph[e].id;
725725
d_edge.source = graph[source(e)].id;
726726
d_edge.target = graph[target(e)].id;

include/cpp_common/ch_edge.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ class CH_edge {
6363
friend std::ostream& operator <<(std::ostream& os, const CH_edge& e);
6464

6565
public:
66-
int64_t id;
67-
int64_t source;
68-
int64_t target;
69-
double cost;
66+
int64_t id{};
67+
int64_t source{};
68+
int64_t target{};
69+
double cost{};
7070

7171
private:
7272
Identifiers<int64_t> m_contracted_vertices;

include/cpp_common/ch_vertex.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace pgrouting {
4141

4242
class CH_vertex {
4343
public:
44-
int64_t id;
44+
int64_t id{};
4545

4646
CH_vertex();
4747
CH_vertex(const Edge_t &other, bool is_source) :

include/cpp_common/line_vertex.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ class Line_vertex {
9393
}
9494

9595
public:
96-
int64_t id;
97-
int64_t vertex_id;
98-
int64_t source;
99-
int64_t target;
100-
double cost;
96+
int64_t id{};
97+
int64_t vertex_id{};
98+
int64_t source{};
99+
int64_t target{};
100+
double cost{};
101101
};
102102

103103
} // namespace pgrouting

include/cpp_common/path.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ class Path {
5757

5858
private:
5959
std::deque< Path_t > path;
60-
int64_t m_start_id;
61-
int64_t m_end_id;
62-
double m_tot_cost;
60+
int64_t m_start_id{};
61+
int64_t m_end_id{};
62+
double m_tot_cost{};
6363

6464
public:
6565
Path(): m_start_id(0), m_end_id(0), m_tot_cost(0)

include/lineGraph/lineGraphFull.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class Pgr_lineGraphFull : public Pgr_base_graph<G, T_V, T_E, t_directed> {
292292
}
293293

294294
private:
295-
int64_t m_num_edges;
295+
int64_t m_num_edges{};
296296
std::map < int64_t, double > m_edge_costs;
297297
std::map < int64_t, std::pair< int64_t, int64_t > > m_transformation_map;
298298
std::map < std::pair< int64_t, int64_t >, int64_t > m_vertex_map;

include/max_flow/maxflow.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ class PgrFlowGraph {
193193
* The same applies for sinks.
194194
* To avoid code repetition, a supersource/sink is used even in the one to one signature.
195195
*/
196-
V supersource;
197-
V supersink;
196+
V supersource{};
197+
V supersink{};
198198
};
199199

200200
} // namespace graph

include/max_flow/minCostMaxFlow.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ class PgrCostFlowGraph {
138138
* The same applies for sinks.
139139
* To avoid code repetition, a supersource/sink is used even in the one to one signature.
140140
*/
141-
V supersource;
142-
V supersink;
141+
V supersource{};
142+
V supersink{};
143143
};
144144

145145
} // namespace graph

0 commit comments

Comments
 (0)