--- trunk/gadget/popinfo.h 2015/04/29 12:55:30 2 +++ trunk/gadget/popinfo.h 2015/04/30 12:52:16 3 @@ -13,7 +13,9 @@ /** * \brief This is the PopInfo constructor */ - PopInfo() { N = 0.0; W = 0.0; }; + PopInfo(double Ni = 0.0, double Wi = 0.0) + : N(Ni), W(Wi) + {}; /** * \brief This is the PopInfo destructor */ @@ -44,12 +46,17 @@ * \brief This operator will set the PopInfo equal to an existing PopInfo * \param a is the PopInfo to copy */ - PopInfo& operator = (const PopInfo& a); + PopInfo& operator = (const PopInfo& a) { + N = a.N; + W = a.W; + return *this; + } + /** * \brief This operator will add an existing PopInfo to the current PopInfo * \param a is the PopInfo to add */ - PopInfo& operator += (const PopInfo& a){ + PopInfo& operator += (const PopInfo& a) { if (isZero(N + a.N)) { W = 0.0; N = 0.0; @@ -71,7 +78,9 @@ * \brief This operator will multiply the PopInfo by a constant * \param a is the constant */ - PopInfo operator * (double a); + PopInfo operator * (double a) const { + return PopInfo(N * a, W); + } }; #endif