Skip to content

Commit 3735984

Browse files
committed
werror maybe unitialized particle
1 parent 1f84688 commit 3735984

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/core/data/particles/particle.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ template<size_t dim>
4040
struct Particle
4141
{
4242
static_assert(dim > 0 and dim < 4, "Only dimensions 1,2,3 are supported.");
43-
static const size_t dimension = dim;
43+
static size_t const dimension = dim;
4444

4545
Particle(double a_weight, double a_charge, std::array<int, dim> cell,
4646
std::array<double, dim> a_delta, std::array<double, 3> a_v)
@@ -57,9 +57,10 @@ struct Particle
5757
double weight = 0;
5858
double charge = 0;
5959

60-
std::array<int, dim> iCell = ConstArray<int, dim>();
61-
std::array<double, dim> delta = ConstArray<double, dim>();
62-
std::array<double, 3> v = ConstArray<double, 3>();
60+
// {} zero initialization
61+
std::array<int, dim> iCell{};
62+
std::array<double, dim> delta{};
63+
std::array<double, 3> v{};
6364

6465
NO_DISCARD bool operator==(Particle<dim> const& that) const
6566
{
@@ -121,9 +122,9 @@ inline constexpr auto is_phare_particle_type
121122

122123
template<std::size_t dim, template<std::size_t> typename ParticleA,
123124
template<std::size_t> typename ParticleB>
124-
NO_DISCARD typename std::enable_if_t<
125-
is_phare_particle_type<dim, ParticleA<dim>> and is_phare_particle_type<dim, ParticleB<dim>>,
126-
bool>
125+
NO_DISCARD typename std::enable_if_t<is_phare_particle_type<dim, ParticleA<dim>>
126+
and is_phare_particle_type<dim, ParticleB<dim>>,
127+
bool>
127128
operator==(ParticleA<dim> const& particleA, ParticleB<dim> const& particleB)
128129
{
129130
return particleA.weight == particleB.weight and //

0 commit comments

Comments
 (0)