lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master e23c058 6/7: Prefer data-member initializers


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e23c058 6/7: Prefer data-member initializers to ctor delegation
Date: Sat, 6 Mar 2021 17:55:55 -0500 (EST)

branch: master
commit e23c05881b395666d139b57aae5f9e734b5fe685
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Prefer data-member initializers to ctor delegation
---
 miscellany.hpp | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/miscellany.hpp b/miscellany.hpp
index cb803a7..3decf62 100644
--- a/miscellany.hpp
+++ b/miscellany.hpp
@@ -95,14 +95,9 @@ template<typename T>
 class minmax
 {
   public:
-    minmax()
-        :minimum_ {std::numeric_limits<T>::max()}
-        ,maximum_ {std::numeric_limits<T>::lowest()}
-        {
-        }
+    minmax() {}
 
     explicit minmax(std::vector<T> const& v)
-        :minmax {}
         {
         if(v.empty())
             {
@@ -124,8 +119,8 @@ class minmax
     T maximum() const {return maximum_;}
 
   private:
-    T minimum_;
-    T maximum_;
+    T minimum_ {std::numeric_limits<T>::max()};
+    T maximum_ {std::numeric_limits<T>::lowest()};
 };
 
 template<typename T> bool operator< (T t, minmax<T> m) {return t <  
m.minimum();}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]