]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/lexical_cast/example/variant_to_long_double.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / lexical_cast / example / variant_to_long_double.cpp
index e4f3bc061d78a0c9ede4a9bc43f604eee6ab1955..2e205f6382d11220bfe9c6286e531614275faae2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright Antony Polukhin, 2013-2019.
+// Copyright Antony Polukhin, 2013-2020.
 
 // Distributed under the Boost Software License, Version 1.0.
 // (See the accompanying file LICENSE_1_0.txt
@@ -12,7 +12,6 @@
 
 #include <boost/lexical_cast.hpp>
 #include <boost/variant.hpp>
-#include <cassert>
 
 struct to_long_double_functor: boost::static_visitor<long double> {
     template <class T>
@@ -33,9 +32,11 @@ int main() {
     boost::variant<char, int, std::string> v1('0'), v2("10.0001"), v3(1);
 
     const long double sum = to_long_double(v1) + to_long_double(v2) + to_long_double(v3);
-    const int ret = (sum > 11 && sum < 11.1 ? 0 : 1);
-    assert(ret == 0);
-    return ret;
+    if (11 < sum  && sum < 11.1) {
+        return 0;  // OK, as expected
+    };
+
+    return 1;      // FAIL
 }
 
 //] [/lexical_cast_variant_to_long_double]