2
0
mirror of https://github.com/boostorg/spirit.git synced 2026-01-19 04:42:11 +00:00

Disable Boost.Math real_concept on C++03 (it now requires C++11)

This commit is contained in:
Nikita Kniazev
2021-02-08 22:35:35 +03:00
parent f3998fb2bb
commit 9a9bbcfb2e
6 changed files with 23 additions and 13 deletions

View File

@@ -8,10 +8,10 @@
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#==============================================================================
#
# Spirit regression test boost-jam file
# Joel de Guzman [Sept 27, 2002]
#
import config : requires ;
###############################################################################
project spirit-classic
: requirements
@@ -71,7 +71,7 @@ local multi-threading = <library>boost_thread
[ spirit-run char_strings_test.cpp ]
[ compile-fail char_strings_test_fail.cpp ]
[ spirit-run numerics_tests.cpp : : : $(opt) ]
[ spirit-run custom_real_parser.cpp ]
[ spirit-run custom_real_parser.cpp : : : [ requires cxx11_sfinae_expr ] ]
;
test-suite "spirit.classic.core.composite"

View File

@@ -12,7 +12,6 @@
#include <boost/version.hpp>
#include <boost/config/warning_disable.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/math/concepts/real_concept.hpp>
#include <boost/spirit/include/karma_char.hpp>
#include <boost/spirit/include/karma_numeric.hpp>
@@ -22,6 +21,12 @@
#include <boost/limits.hpp>
#include "test.hpp"
#ifndef BOOST_NO_CXX11_SFINAE_EXPR
# include <boost/math/concepts/real_concept.hpp>
#else
# define BOOST_SPIRIT_NO_MATH_REAL_CONCEPT
#endif
using namespace spirit_test;
///////////////////////////////////////////////////////////////////////////////

View File

@@ -11,8 +11,7 @@
#include "real.hpp"
///////////////////////////////////////////////////////////////////////////////
// the customization points below have been added only recently
#if SPIRIT_VERSION >= 0x2050
#ifndef BOOST_SPIRIT_NO_MATH_REAL_CONCEPT
// does not provide proper std::numeric_limits, we need to roll our own
namespace boost { namespace spirit { namespace traits
{
@@ -78,10 +77,7 @@ int main()
BOOST_TEST(test("-123420000000000000000.0", fixed, -1.23420e20));
}
// support for using real_concept with a Karma generator has been implemented
// in Boost versions > 1.36 only, additionally real_concept is available only
// if BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS is not defined
#if BOOST_VERSION > 103600 && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
#ifndef BOOST_SPIRIT_NO_MATH_REAL_CONCEPT
{
using boost::math::concepts::real_concept;
typedef karma::real_generator<real_concept> custom_type;

View File

@@ -10,7 +10,6 @@
#define BOOST_SPIRIT_TEST_QI_REAL_HPP
#include <climits>
#include <boost/math/concepts/real_concept.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/spirit/include/qi_char.hpp>
#include <boost/spirit/include/qi_numeric.hpp>
@@ -20,6 +19,12 @@
#include "test.hpp"
#ifndef BOOST_NO_CXX11_SFINAE_EXPR
# include <boost/math/concepts/real_concept.hpp>
#else
# define BOOST_SPIRIT_NO_MATH_REAL_CONCEPT
#endif
///////////////////////////////////////////////////////////////////////////////
// These policies can be used to parse thousand separated
// numbers with at most 2 decimal digits after the decimal

View File

@@ -19,6 +19,7 @@ main()
///////////////////////////////////////////////////////////////////////////
// Custom data type
///////////////////////////////////////////////////////////////////////////
#ifndef BOOST_SPIRIT_NO_MATH_REAL_CONCEPT
{
using boost::math::concepts::real_concept;
using boost::spirit::qi::real_parser;
@@ -58,6 +59,7 @@ main()
BOOST_TEST(!test("-1.2e", custom_real));
BOOST_TEST(!test_attr("-1.2e", custom_real, d));
}
#endif
///////////////////////////////////////////////////////////////////////////
// custom real tests

View File

@@ -76,6 +76,7 @@ main()
///////////////////////////////////////////////////////////////////////////
// parameterized custom data type
///////////////////////////////////////////////////////////////////////////
#ifndef BOOST_SPIRIT_NO_MATH_REAL_CONCEPT
{
using boost::math::concepts::real_concept;
using boost::spirit::qi::real_parser;
@@ -96,6 +97,7 @@ main()
BOOST_TEST(compare(d, 1.2e3));
BOOST_TEST(!test_attr("1.2e3", custom_real(-3.2e1), d));
}
#endif
///////////////////////////////////////////////////////////////////////////
// parameterized lazy tests