Remove use of boost.static_assert

This commit is contained in:
Matt Borland 2023-12-20 15:55:15 +01:00
parent 1bef73bfdc
commit 8c095fed5b
No known key found for this signature in database
GPG Key ID: 30EFCE23CA65A72C
14 changed files with 49 additions and 60 deletions

View File

@ -29,7 +29,6 @@ target_link_libraries(boost_numeric_odeint
Boost::numeric_ublas
Boost::preprocessor
Boost::range
Boost::static_assert
Boost::throw_exception
Boost::type_traits
Boost::units

View File

@ -104,7 +104,7 @@ int main()
x[0] = 5.0 ; x[1] = 10.0 ; x[2] = 10.0;
// make sure resizing is ON
BOOST_STATIC_ASSERT( is_resizeable<state_type>::value == true );
static_assert( is_resizeable<state_type>::value == true, "Resizing must be on" );
// my_vector works with range_algebra as it implements
// the required parts of a container interface

View File

@ -32,11 +32,4 @@
#endif // __CUDACC__
/*
#define BOOST_ODEINT_CHECK_OPERATION_ARITY( Operation , Arity ) \
BOOST_STATIC_ASSERT(( boost::function_traits< Operation >::arity == Arity ))
*/
#endif // BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED

View File

@ -122,7 +122,7 @@ struct fusion_algebra
template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class Op >
static void for_each8( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , Op op )
{
BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 8 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
static_assert( BOOST_FUSION_INVOKE_MAX_ARITY >= 8 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& > Sequences;
Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 );
boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
@ -131,7 +131,7 @@ struct fusion_algebra
template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class Op >
static void for_each9( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , Op op )
{
BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 9 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
static_assert( BOOST_FUSION_INVOKE_MAX_ARITY >= 9 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& > Sequences;
Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 );
boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
@ -140,7 +140,7 @@ struct fusion_algebra
template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class Op >
static void for_each10( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , Op op )
{
BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 10 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
static_assert( BOOST_FUSION_INVOKE_MAX_ARITY >= 10 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& > Sequences;
Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 );
boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
@ -149,8 +149,8 @@ struct fusion_algebra
template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class Op >
static void for_each11( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , Op op )
{
BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 11 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 11 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
static_assert( BOOST_FUSION_INVOKE_MAX_ARITY >= 11 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
static_assert( BOOST_RESULT_OF_NUM_ARGS >= 11 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& > Sequences;
Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 );
boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
@ -159,8 +159,8 @@ struct fusion_algebra
template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class Op >
static void for_each12( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , Op op )
{
BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 12 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 12 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
static_assert( BOOST_FUSION_INVOKE_MAX_ARITY >= 12 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
static_assert( BOOST_RESULT_OF_NUM_ARGS >= 12 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& > Sequences;
Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 );
boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
@ -169,8 +169,8 @@ struct fusion_algebra
template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class Op >
static void for_each13( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , Op op )
{
BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 13 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 13 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
static_assert( BOOST_FUSION_INVOKE_MAX_ARITY >= 13 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
static_assert( BOOST_RESULT_OF_NUM_ARGS >= 13 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& > Sequences;
Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 );
boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
@ -179,8 +179,8 @@ struct fusion_algebra
template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class Op >
static void for_each14( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , Op op )
{
BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 14 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 14 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
static_assert( BOOST_FUSION_INVOKE_MAX_ARITY >= 14 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
static_assert( BOOST_RESULT_OF_NUM_ARGS >= 14 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& , S14& > Sequences;
Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 );
boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );
@ -189,8 +189,8 @@ struct fusion_algebra
template< class S1 , class S2 , class S3 , class S4 , class S5 , class S6 , class S7 , class S8 , class S9 , class S10 , class S11 , class S12 , class S13 , class S14 , class S15 , class Op >
static void for_each15( S1 &s1 , S2 &s2 , S3 &s3 , S4 &s4 , S5 &s5 , S6 &s6 , S7 &s7 , S8 &s8 , S9 &s9 , S10 &s10 , S11 &s11 , S12 &s12 , S13 &s13 , S14 &s14 , S15 &s15 , Op op )
{
BOOST_STATIC_ASSERT_MSG( BOOST_FUSION_INVOKE_MAX_ARITY >= 15 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
BOOST_STATIC_ASSERT_MSG( BOOST_RESULT_OF_NUM_ARGS >= 15 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
static_assert( BOOST_FUSION_INVOKE_MAX_ARITY >= 15 , "Macro Parameter BOOST_FUSION_INVOKE_MAX_ARITY to small!" );
static_assert( BOOST_RESULT_OF_NUM_ARGS >= 15 , "Macro Parameter BOOST_RESULT_OF_NUM_ARGS to small!" );
typedef boost::fusion::vector< S1& , S2& , S3& , S4& , S5& , S6& , S7& , S8& , S9& , S10& , S11& , S12& , S13& , S14& , S15& > Sequences;
Sequences sequences( s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 , s15 );
boost::fusion::for_each( boost::fusion::zip_view< Sequences >( sequences ) , boost::fusion::make_fused( op ) );

View File

@ -85,8 +85,7 @@ class adams_bashforth : public algebra_stepper_base< Algebra , Operations >
{
#ifndef DOXYGEN_SKIP
BOOST_STATIC_ASSERT(( Steps > 0 ));
BOOST_STATIC_ASSERT(( Steps < 9 ));
static_assert(( Steps > 0 && Steps < 9 ), "Must have between 1 and 8 steps inclusive");
#endif
public :

View File

@ -56,8 +56,7 @@ class adams_bashforth_moulton
{
#ifndef DOXYGEN_SKIP
BOOST_STATIC_ASSERT(( Steps > 0 ));
BOOST_STATIC_ASSERT(( Steps < 9 ));
static_assert(( Steps > 0 && Steps < 9 ), "Must have between 1 and 8 steps inclusive");
#endif
public :

View File

@ -67,7 +67,7 @@ class extrapolation_stepper : public explicit_error_stepper_base
private:
// check for Order being odd
BOOST_STATIC_ASSERT_MSG(
static_assert(
( ( Order % 2 ) == 0 ) && ( Order > 2 ),
"extrapolation_stepper requires even Order larger than 2" );

View File

@ -43,38 +43,38 @@ BOOST_AUTO_TEST_SUITE( algebra_dispatcher_test )
BOOST_AUTO_TEST_CASE( range_algebra_with_vector )
{
typedef runge_kutta4< std::vector< double > > stepper_type;
BOOST_STATIC_ASSERT(( boost::is_same< stepper_type::algebra_type , range_algebra >::value ));
static_assert(( boost::is_same< stepper_type::algebra_type , range_algebra >::value ), "Not range algebra");
}
BOOST_AUTO_TEST_CASE( array_algebra_with_array )
{
typedef runge_kutta4< std::array< double , 2 > > stepper_type;
BOOST_STATIC_ASSERT(( boost::is_same< stepper_type::algebra_type , array_algebra >::value ));
static_assert(( boost::is_same< stepper_type::algebra_type , array_algebra >::value ), "Not array algebra");
}
BOOST_AUTO_TEST_CASE( range_algebra_with_array )
{
typedef runge_kutta4< std::array< double , 2 > , double , std::array< double , 2 > , double , range_algebra > stepper_type;
BOOST_STATIC_ASSERT(( boost::is_same< stepper_type::algebra_type , range_algebra >::value ));
static_assert(( boost::is_same< stepper_type::algebra_type , range_algebra >::value ), "Not range algebra");
}
BOOST_AUTO_TEST_CASE( fusion_algebra_with_fusion_vector )
{
typedef runge_kutta4< boost::fusion::vector< double > > stepper_type;
BOOST_STATIC_ASSERT(( boost::is_same< stepper_type::algebra_type , fusion_algebra >::value ));
static_assert(( boost::is_same< stepper_type::algebra_type , fusion_algebra >::value ), "Not fusion algebra");
}
BOOST_AUTO_TEST_CASE( fusion_algebra_with_fusion_vector2 )
{
typedef runge_kutta_fehlberg78< boost::fusion::vector< double > > stepper_type;
BOOST_STATIC_ASSERT(( boost::is_same< stepper_type::algebra_type , fusion_algebra >::value ));
static_assert(( boost::is_same< stepper_type::algebra_type , fusion_algebra >::value ), "Not fusion algebra");
}
typedef boost::mpl::list< float , double , long double , std::complex< double > , std::complex< float > > fp_types;
BOOST_AUTO_TEST_CASE_TEMPLATE( vector_space_algebra_with_floating_point , T , fp_types )
{
typedef runge_kutta_fehlberg78< T > stepper_type;
BOOST_STATIC_ASSERT(( boost::is_same< typename stepper_type::algebra_type , vector_space_algebra >::value ));
static_assert(( boost::is_same< typename stepper_type::algebra_type , vector_space_algebra >::value ), "Not vector space algebra");
}

View File

@ -31,7 +31,7 @@ using namespace boost::numeric::odeint;
template< class Stepper1 , class Stepper2 >
void check_stepper_type( const Stepper1 &s1 , const Stepper2 &s2 )
{
BOOST_STATIC_ASSERT(( boost::is_same< Stepper1 , Stepper2 >::value ));
static_assert(( boost::is_same< Stepper1 , Stepper2 >::value ), "Stepper1 and Stepper2 must be the same type");
}
BOOST_AUTO_TEST_SUITE( generation_test )

View File

@ -38,12 +38,12 @@ BOOST_AUTO_TEST_CASE( test_is_pair )
typedef std::pair< const int , int > type5;
typedef std::pair< const int& , int > type6;
BOOST_STATIC_ASSERT(( is_pair< type1 >::value ));
BOOST_STATIC_ASSERT(( is_pair< type2 >::value ));
BOOST_STATIC_ASSERT(( is_pair< type3 >::value ));
BOOST_STATIC_ASSERT(( is_pair< type4 >::value ));
BOOST_STATIC_ASSERT(( is_pair< type5 >::value ));
BOOST_STATIC_ASSERT(( is_pair< type6 >::value ));
static_assert(( is_pair< type1 >::value ), "Not a pair");
static_assert(( is_pair< type2 >::value ), "Not a pair");
static_assert(( is_pair< type3 >::value ), "Not a pair");
static_assert(( is_pair< type4 >::value ), "Not a pair");
static_assert(( is_pair< type5 >::value ), "Not a pair");
static_assert(( is_pair< type6 >::value ), "Not a pair");
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -38,11 +38,10 @@ BOOST_AUTO_TEST_CASE( test_case )
state_type x = {0.0, 0.0, 0.0};
typedef boost::numeric::odeint::runge_kutta4<state_type> stepper_type;
// check if array algebra is selected, but only if odeint detects c++11
#ifdef BOOST_NUMERIC_ODEINT_CXX11
BOOST_STATIC_ASSERT(( boost::is_same< stepper_type::algebra_type ,
boost::numeric::odeint::array_algebra >::value ));
#endif
static_assert(( boost::is_same< stepper_type::algebra_type ,
boost::numeric::odeint::array_algebra >::value ), "Not array algebra");
stepper_type stepper1;
stepper1.do_step(rhs, x, 0.0, 0.1);

View File

@ -128,33 +128,33 @@ BOOST_AUTO_TEST_SUITE( symplectic_steppers_test )
BOOST_AUTO_TEST_CASE_TEMPLATE( test_assoc_types , Stepper , vector_steppers< initially_resizer > )
{
BOOST_STATIC_ASSERT_MSG(
static_assert(
( boost::is_same< typename Stepper::coor_type , diagnostic_state_type >::value ) ,
"Coordinate type" );
BOOST_STATIC_ASSERT_MSG(
static_assert(
( boost::is_same< typename Stepper::momentum_type , diagnostic_state_type2 >::value ) ,
"Momentum type" );
BOOST_STATIC_ASSERT_MSG(
static_assert(
( boost::is_same< typename Stepper::coor_deriv_type , diagnostic_deriv_type >::value ) ,
"Coordinate deriv type" );
BOOST_STATIC_ASSERT_MSG(
static_assert(
( boost::is_same< typename Stepper::momentum_deriv_type , diagnostic_deriv_type2 >::value ) ,
"Momentum deriv type" );
BOOST_STATIC_ASSERT_MSG(
static_assert(
( boost::is_same< typename Stepper::state_type , std::pair< diagnostic_state_type , diagnostic_state_type2 > >::value ) ,
"State type" );
BOOST_STATIC_ASSERT_MSG(
static_assert(
( boost::is_same< typename Stepper::deriv_type , std::pair< diagnostic_deriv_type , diagnostic_deriv_type2 > >::value ) ,
"Deriv type" );
BOOST_STATIC_ASSERT_MSG( ( boost::is_same< typename Stepper::value_type , double >::value ) , "Value type" );
BOOST_STATIC_ASSERT_MSG( ( boost::is_same< typename Stepper::time_type , double >::value ) , "Time type" );
BOOST_STATIC_ASSERT_MSG( ( boost::is_same< typename Stepper::algebra_type , custom_range_algebra >::value ) , "Algebra type" );
BOOST_STATIC_ASSERT_MSG( ( boost::is_same< typename Stepper::operations_type , custom_default_operations >::value ) , "Operations type" );
static_assert( ( boost::is_same< typename Stepper::value_type , double >::value ) , "Value type" );
static_assert( ( boost::is_same< typename Stepper::time_type , double >::value ) , "Time type" );
static_assert( ( boost::is_same< typename Stepper::algebra_type , custom_range_algebra >::value ) , "Algebra type" );
static_assert( ( boost::is_same< typename Stepper::operations_type , custom_default_operations >::value ) , "Operations type" );
BOOST_STATIC_ASSERT_MSG( ( boost::is_same< typename Stepper::resizer_type , initially_resizer >::value ) , "Resizer type" );
BOOST_STATIC_ASSERT_MSG( ( boost::is_same< typename Stepper::stepper_category , stepper_tag >::value ) , "Stepper category" );
static_assert( ( boost::is_same< typename Stepper::resizer_type , initially_resizer >::value ) , "Resizer type" );
static_assert( ( boost::is_same< typename Stepper::stepper_category , stepper_tag >::value ) , "Stepper category" );
}

View File

@ -34,13 +34,13 @@ BOOST_AUTO_TEST_SUITE( is_resizeable )
BOOST_AUTO_TEST_CASE( test_compile_time_matrix )
{
typedef Eigen::Matrix< double , 1 , 1 > matrix_type;
BOOST_STATIC_ASSERT(( boost::numeric::odeint::is_resizeable< matrix_type >::value ));
static_assert(( boost::numeric::odeint::is_resizeable< matrix_type >::value ), "Matrix is not resizeable");
}
BOOST_AUTO_TEST_CASE( test_compile_time_array )
{
typedef Eigen::Array< double , 1 , 1 > array_type;
BOOST_STATIC_ASSERT(( boost::numeric::odeint::is_resizeable< array_type >::value ));
static_assert(( boost::numeric::odeint::is_resizeable< array_type >::value ), "Array is not resizeable");
}

View File

@ -30,7 +30,7 @@ BOOST_AUTO_TEST_SUITE( nt2_is_resizeable )
BOOST_AUTO_TEST_CASE_TEMPLATE( is_resizeable, T, fp_types )
{
BOOST_STATIC_ASSERT(( boost::numeric::odeint::is_resizeable< nt2::table<T> >::value ));
static_assert(( boost::numeric::odeint::is_resizeable< nt2::table<T> >::value ), "Table is not resizeable");
}
BOOST_AUTO_TEST_SUITE_END()