[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();}
- [lmi-commits] [lmi] master updated (27b708a -> 7d2794b), Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 869de45 4/7: Fix defect introduced 20180319T1957Z: min() isn't lowest(), Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 7d2794b 7/7: Use minmax<T> iff std::numeric_limits<T>::is_bounded, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 5004bd4 5/7: Define 'minmax' of an empty vector, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master e23c058 6/7: Prefer data-member initializers to ctor delegation,
Greg Chicares <=
- [lmi-commits] [lmi] master 24611b1 1/7: Improve a unit test, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 8e69f1d 2/7: Don't write lowest() as "min()" without asserting they're the same, Greg Chicares, 2021/03/06
- [lmi-commits] [lmi] master 3330a9a 3/7: Don't write lowest() as "min()" even it they're the same, Greg Chicares, 2021/03/06