Skip to content

the default constructor should zero-initialize the members of `realm::Point`

Eric Niebler requested to merge point-default-initialization into master

At present, code such as the following:

realm::Point<2> p {};

will have uninitialized data members. This is surprising since the same syntax used on integers will zero-initialize them.

int i {};
assert( i == 0 );

By marking Point's default constructor with = default, we make Point behave as the integers do with respect to default initialization.

Note that a Point without an initializer will still be uninitialized:

Point<2> p;
// WARNING: p.x and p.y are uninitialized here!

Merge request reports