-// 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
#include <boost/lexical_cast.hpp>
#include <boost/variant.hpp>
-#include <cassert>
struct to_long_double_functor: boost::static_visitor<long double> {
template <class T>
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]