lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master b68c82e 4/5: Replace implicit 2==radix assump


From: Greg Chicares
Subject: [lmi-commits] [lmi] master b68c82e 4/5: Replace implicit 2==radix assumption with explicit assertion
Date: Thu, 13 Apr 2017 06:58:29 -0400 (EDT)

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

    Replace implicit 2==radix assumption with explicit assertion
---
 bourn_cast.hpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bourn_cast.hpp b/bourn_cast.hpp
index b408835..d9c4b2d 100644
--- a/bourn_cast.hpp
+++ b/bourn_cast.hpp
@@ -217,6 +217,9 @@ inline To bourn_cast(From from, std::true_type, 
std::true_type)
 /// instead of quietly truncating, it throws on floating-to-integral
 /// conversions that would not preserve value.
 ///
+/// The radix of all numeric types is asserted to be two because this
+/// implementation has not been tested with any other radix.
+///
 /// Facilities provided by <limits> are used to the exclusion of
 /// <type_traits> functions such as
 ///   is_arithmetic()
@@ -239,6 +242,9 @@ inline To bourn_cast(From from)
     static_assert(  to_traits::is_specialized, "");
     static_assert(from_traits::is_specialized, "");
 
+    static_assert(2 ==   to_traits::radix, "");
+    static_assert(2 == from_traits::radix, "");
+
     static constexpr bool   to_integer =   to_traits::is_integer;
     static constexpr bool from_integer = from_traits::is_integer;
 



reply via email to

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