Skip to content

Commit f398041

Browse files
authored
Merge pull request #961 from nicolasaunai/particle_werror
werror particle may be uninitialized
2 parents 7f2a93d + 3000b70 commit f398041

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/core/data/particles/particle_packer.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ namespace PHARE::core
1414
template<std::size_t dim>
1515
class ParticlePacker
1616
{
17+
constexpr static Particle<dim> default_particle{};
18+
1719
public:
1820
static constexpr std::size_t n_keys = 5;
1921

@@ -28,11 +30,7 @@ class ParticlePacker
2830
particle.delta, particle.v);
2931
}
3032

31-
static auto empty()
32-
{
33-
Particle<dim> particle{};
34-
return get(particle);
35-
}
33+
static constexpr auto empty() { return get(default_particle); }
3634

3735
// sometimes we use this to infer the size of an ParticleArray
3836
// could be "charge" either
@@ -65,7 +63,7 @@ class ParticlePacker
6563
private:
6664
ParticleArray<dim> const& particles_;
6765
std::size_t it_ = 0;
68-
static inline const std::array<std::string, n_keys> keys_{"weight", "charge", "iCell", "delta",
66+
static inline std::array<std::string, n_keys> const keys_{"weight", "charge", "iCell", "delta",
6967
"v"};
7068
};
7169

0 commit comments

Comments
 (0)