lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master c123152 5/6: Replace typedefs with alias-decl


From: Greg Chicares
Subject: [lmi-commits] [lmi] master c123152 5/6: Replace typedefs with alias-declarations
Date: Mon, 6 Mar 2017 19:46:58 -0500 (EST)

branch: master
commit c1231520f5c918defe05c2251acfc0c80f53052e
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Replace typedefs with alias-declarations
    
    Also shortened a really_long_name.
---
 round_to.hpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/round_to.hpp b/round_to.hpp
index de963cd..be13c1e 100644
--- a/round_to.hpp
+++ b/round_to.hpp
@@ -39,8 +39,8 @@
 // Power-of-ten scaling factors are best represented in the maximum
 // available precision, which is indicated by type 'max_prec_real'.
 //
-// Changing this typedef lets you use a nonstandard type or class with
-// greater precision if desired.
+// Change this alias-declaration to use a nonstandard type or class
+// with greater precision if desired.
 //
 // Alternatively, suppose your hardware offers an extended format,
 // but you can't or don't take advantage of it--either your compiler
@@ -49,8 +49,8 @@
 // If the compiler nonetheless treats double and long double as
 // distinct types, then it might generate extra machine code to
 // convert between those types. You could prevent that by changing
-// this typedef to double.
-typedef long double max_prec_real;
+// this alias-declaration to double.
+using max_prec_real = long double;
 
 // Any modern C++ compiler provides std::rint().
 #define LMI_HAVE_RINT
@@ -297,14 +297,14 @@ class round_to
     rounding_style style() const;
 
   private:
-    typedef RealType (*rounding_function_t)(RealType);
-    rounding_function_t select_rounding_function(rounding_style) const;
+    using rounding_fn_t = RealType (*)(RealType);
+    rounding_fn_t select_rounding_function(rounding_style) const;
 
     int decimals_;
     rounding_style style_;
     max_prec_real scale_fwd_;
     max_prec_real scale_back_;
-    rounding_function_t rounding_function_;
+    rounding_fn_t rounding_function_;
 };
 
 /// This default ctor serves only to render the class DefaultConstructible.
@@ -414,7 +414,7 @@ rounding_style round_to<RealType>::style() const
 
 // Choose the auxiliary rounding function indicated by the argument.
 template<typename RealType>
-typename round_to<RealType>::rounding_function_t
+typename round_to<RealType>::rounding_fn_t
 round_to<RealType>::select_rounding_function(rounding_style const a_style) 
const
 {
 #if defined LMI_HAVE_RINT



reply via email to

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