BUG: Tuple2 construct null with uninitialized value

Had this:

    Tuple2() {}

Instead of:

    Tuple2() : f_(), s_() {}

which is the same as

    Tuple2() = default;

This meant that Tuple2<scalar, scalar>() was not being zero-initialized
This commit is contained in:
Mark Olesen
2019-01-08 21:58:08 +01:00
parent 26d0d48fb5
commit 08dc8d0e39
3 changed files with 5 additions and 11 deletions

View File

@ -61,8 +61,8 @@ public:
// Constructors
//- Null constructor
inline Pair();
//- Construct null
Pair() = default;
//- Construct from components
inline Pair(const T& f, const T& s);

View File

@ -45,11 +45,6 @@ inline int Foam::Pair<T>::compare(const Pair<T>& a, const Pair<T>& b)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T>
inline Foam::Pair<T>::Pair()
{}
template<class T>
inline Foam::Pair<T>::Pair(const T& f, const T& s)
{

View File

@ -57,7 +57,7 @@ inline Ostream& operator<<(Ostream& os, const Tuple2<Type1, Type2>& t2);
/*---------------------------------------------------------------------------*\
class Tuple2 Declaration
Class Tuple2 Declaration
\*---------------------------------------------------------------------------*/
template<class Type1, class Type2>
@ -81,9 +81,8 @@ public:
// Constructors
//- Null constructor for lists and hashes
inline Tuple2()
{}
//- Construct null
inline Tuple2() = default;
//- Construct from components
inline Tuple2(const Type1& f, const Type2& s)