2
0
mirror of https://github.com/boostorg/odeint.git synced 2026-01-19 04:22:12 +00:00

Begin replacing boost/type_traits

This commit is contained in:
Matt Borland
2023-12-20 15:43:01 +01:00
parent ccf0f9278e
commit 1bef73bfdc
18 changed files with 27 additions and 59 deletions

View File

@@ -17,10 +17,11 @@
#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_ALGEBRA_DISPATCHER_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_ALGEBRA_ALGEBRA_DISPATCHER_HPP_INCLUDED
#include <boost/numeric/odeint/config.hpp>
#include <type_traits>
#include <complex>
#include <boost/type_traits/is_floating_point.hpp>
#include <array>
#include <boost/numeric/odeint/config.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
@@ -29,9 +30,6 @@
#include <boost/numeric/odeint/algebra/array_algebra.hpp>
#include <boost/numeric/odeint/algebra/vector_space_algebra.hpp>
#include <array>
namespace boost {
namespace numeric {
namespace odeint {
@@ -55,7 +53,7 @@ struct algebra_dispatcher< std::array< T , N > >
//specialize for some integral types
template< typename T >
struct algebra_dispatcher_sfinae< T , typename boost::enable_if< typename boost::is_floating_point< T >::type >::type >
struct algebra_dispatcher_sfinae< T , typename std::enable_if< std::is_floating_point< T >::value >::type >
{
typedef vector_space_algebra algebra_type;
};

View File

@@ -17,11 +17,11 @@
#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED
#include <type_traits>
#include <boost/utility.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/type_traits/is_same.hpp>
BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
@@ -40,8 +40,8 @@ struct extract_value_type
// e.g. returning S::value_type::value_type::value_type
template< typename S >
struct extract_value_type< S , typename boost::enable_if< has_value_type<S> >::type >
: mpl::if_< is_same< S, typename S::value_type > ,
struct extract_value_type< S , typename std::enable_if< has_value_type<S>::value >::type >
: mpl::if_< std::is_same< S, typename S::value_type > ,
mpl::identity< S > , // cut the recursion if S and S::value_type are the same
extract_value_type< typename S::value_type > >::type
{};

View File

@@ -18,14 +18,13 @@
#ifndef BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_MACROS_HPP_INCLUDED
#include <type_traits>
//type traits aren't working with nvcc
#ifndef __CUDACC__
#include <boost/type_traits.hpp>
#include <boost/static_assert.hpp>
#define BOOST_ODEINT_CHECK_CONTAINER_TYPE( Type1 , Type2 ) \
BOOST_STATIC_ASSERT(( boost::is_same< typename boost::remove_const< Type1 >::type , Type2 >::value ))
static_assert(( std::is_same< typename std::remove_const< Type1 >::type , Type2 >::value ));
#else
//empty macro for nvcc

View File

@@ -20,9 +20,6 @@
#include <complex>
#include <boost/type_traits/remove_reference.hpp>
namespace boost {
namespace numeric {
namespace odeint {

View File

@@ -18,36 +18,32 @@
#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_RESIZE_HPP_DEFINED
#define BOOST_NUMERIC_ODEINT_EXTERNAL_EIGEN_EIGEN_RESIZE_HPP_DEFINED
#include <type_traits>
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/numeric/odeint/util/resize.hpp>
#include <boost/numeric/odeint/util/same_size.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <Eigen/Dense>
namespace boost {
namespace numeric {
namespace odeint {
template< class Derived >
struct is_resizeable_sfinae< Derived ,
typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type >
typename std::enable_if< std::is_base_of< Eigen::MatrixBase< Derived > , Derived >::value >::type >
{
typedef boost::true_type type;
typedef std::integral_constant<bool, true> type;
const static bool value = type::value;
};
template < class Derived >
struct is_resizeable_sfinae< Derived ,
typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type >
typename std::enable_if< std::is_base_of< Eigen::ArrayBase< Derived > , Derived >::value >::type >
{
typedef boost::true_type type;
typedef std::integral_constant<bool, true> type;
const static bool value = type::value;
};
@@ -55,7 +51,7 @@ struct is_resizeable_sfinae< Derived ,
template< class Derived >
struct same_size_impl_sfinae< Derived , Derived ,
typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type >
typename std::enable_if< std::is_base_of< Eigen::MatrixBase< Derived > , Derived >::value >::type >
{
static bool same_size( const Eigen::MatrixBase< Derived > &m1 , const Eigen::MatrixBase< Derived > &m2 )
@@ -66,7 +62,7 @@ struct same_size_impl_sfinae< Derived , Derived ,
template< class Derived >
struct same_size_impl_sfinae< Derived , Derived ,
typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type >
typename std::enable_if< std::is_base_of< Eigen::ArrayBase< Derived > , Derived >::value >::type >
{
static bool same_size( const Eigen::ArrayBase< Derived > &v1 , const Eigen::ArrayBase< Derived > &v2 )
{
@@ -79,7 +75,7 @@ struct same_size_impl_sfinae< Derived , Derived ,
template< class Derived >
struct resize_impl_sfinae< Derived , Derived ,
typename boost::enable_if< typename boost::is_base_of< Eigen::MatrixBase< Derived > , Derived >::type >::type >
typename std::enable_if< std::is_base_of< Eigen::MatrixBase< Derived > , Derived >::value >::type >
{
static void resize( Eigen::MatrixBase< Derived > &m1 , const Eigen::MatrixBase< Derived > &m2 )
{
@@ -89,7 +85,7 @@ struct resize_impl_sfinae< Derived , Derived ,
template< class Derived >
struct resize_impl_sfinae< Derived , Derived ,
typename boost::enable_if< typename boost::is_base_of< Eigen::ArrayBase< Derived > , Derived >::type >::type >
typename std::enable_if< std::is_base_of< Eigen::ArrayBase< Derived > , Derived >::value >::type >
{
static void resize( Eigen::ArrayBase< Derived > &v1 , const Eigen::ArrayBase< Derived > &v2 )
{

View File

@@ -22,7 +22,6 @@
#include <gsl/gsl_vector.h>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/range.hpp>
#include <boost/iterator/iterator_facade.hpp>
@@ -167,8 +166,8 @@ namespace odeint {
template<>
struct is_resizeable< gsl_vector* >
{
//struct type : public boost::true_type { };
typedef boost::true_type type;
//struct type : public std::integral_constant<bool, true> { };
typedef std::integral_constant<bool, true> type;
const static bool value = type::value;
};

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/integrate/null_observer.hpp>
#include <boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp>

View File

@@ -19,7 +19,7 @@
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#include <type_traits>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/integrate/null_observer.hpp>
@@ -44,7 +44,7 @@ size_t integrate_const(
typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category;
// we want to get as fast as possible to the end
// no overflow checks needed
if (boost::is_same<null_observer, Observer>::value) {
BOOST_IF_CONSTEXPR (std::is_same<null_observer, Observer>::value) {
return detail::integrate_adaptive(
stepper, system, start_state,
start_time, end_time, dt,
@@ -77,7 +77,7 @@ size_t integrate_const(
typedef typename odeint::unwrap_reference<Stepper>::type::stepper_category stepper_category;
// we want to get as fast as possible to the end
if (boost::is_same<null_observer, Observer>::value) {
BOOST_IF_CONSTEXPR (std::is_same<null_observer, Observer>::value) {
return detail::integrate_adaptive(
stepper, system, start_state,
start_time, end_time, dt,

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/integrate/null_observer.hpp>
#include <boost/numeric/odeint/integrate/detail/integrate_n_steps.hpp>

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#include <boost/range.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ADAPTIVE_ITERATOR_IMPL_HPP_DEFINED
#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_ADAPTIVE_ITERATOR_IMPL_HPP_DEFINED
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/throw_exception.hpp>
#include <boost/numeric/odeint/util/unit_helper.hpp>

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_TIMES_ITERATOR_IMPL_HPP_DEFINED
#define BOOST_NUMERIC_ODEINT_ITERATOR_DETAIL_TIMES_ITERATOR_IMPL_HPP_DEFINED
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/throw_exception.hpp>
#include <boost/numeric/odeint/util/unit_helper.hpp>

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_ADAPTIVE_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/iterator/integrate/null_observer.hpp>
#include <boost/numeric/odeint/iterator/integrate/detail/integrate_adaptive.hpp>

View File

@@ -19,7 +19,7 @@
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_CONST_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#include <type_traits>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/iterator/integrate/null_observer.hpp>
@@ -46,7 +46,7 @@ size_t integrate_const(
{
typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
// we want to get as fast as possible to the end
if( boost::is_same< null_observer , Observer >::value )
BOOST_IF_CONSTEXPR ( std::is_same< null_observer , Observer >::value )
{
return detail::integrate_adaptive(
stepper , system , start_state ,
@@ -74,7 +74,7 @@ size_t integrate_const(
{
typedef typename odeint::unwrap_reference< Stepper >::type::stepper_category stepper_category;
// we want to get as fast as possible to the end
if( boost::is_same< null_observer , Observer >::value )
BOOST_IF_CONSTEXPR ( std::is_same< null_observer , Observer >::value )
{
return detail::integrate_adaptive(
stepper , system , start_state ,

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_N_STEPS_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>
#include <boost/numeric/odeint/iterator/integrate/null_observer.hpp>
#include <boost/numeric/odeint/iterator/integrate/detail/integrate_n_steps.hpp>

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_INTEGRATE_INTEGRATE_TIMES_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#include <boost/range.hpp>
#include <boost/numeric/odeint/stepper/stepper_categories.hpp>

View File

@@ -45,9 +45,6 @@
#include <boost/numeric/odeint/integrate/max_step_checker.hpp>
#include <boost/type_traits.hpp>
namespace boost {
namespace numeric {
namespace odeint {

View File

@@ -18,8 +18,6 @@
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_STEPPER_CATEGORIES_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_STEPPER_CATEGORIES_HPP_INCLUDED
#include <boost/type_traits/integral_constant.hpp>
namespace boost {
namespace numeric {
namespace odeint {