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

Replace all uses of boost true/false type with std

This commit is contained in:
Matt Borland
2024-05-03 08:26:21 +02:00
parent 8b4768ef49
commit 5e7d7c38e0
23 changed files with 71 additions and 46 deletions

View File

@@ -29,7 +29,7 @@ The `State Wrapper` concept describes the way odeint creates temporary state obj
[table
[[Name] [Expression] [Type] [Semantics]]
[[Get resizeability] [`is_resizeable< State >`] [`boost::false_type` or `boost::true_type`] [Returns `boost::true_type` if the `State` is resizeable, `boost::false_type` otherwise.]]
[[Get resizeability] [`is_resizeable< State >`] [`std::false_type` or `std::true_type`] [Returns `std::true_type` if the `State` is resizeable, `std::false_type` otherwise.]]
[[Create `WrappedState` type] [`state_wrapper< State >`] [`WrappedState`] [Creates the type for a `WrappedState` for the state type `State`]]
[[Constructor] [`WrappedState()`] [`WrappedState`] [Constructs a state wrapper with an empty state]]
[[Copy Constructor] [`WrappedState( w )`] [`WrappedState`] [Constructs a state wrapper with a state of the same size as the state in `w`]]

View File

@@ -81,8 +81,8 @@ First, the state has to be tagged as resizeable by specializing the struct
[table
[[Name] [Expression] [Type] [Semantics]]
[[Resizability] [`is_resizeable<State>::type`]
[`boost::true_type` or `boost::false_type`]
[Determines resizeability of the state type, returns `boost::true_type` if
[`std::true_type` or `std::false_type`]
[Determines resizeability of the state type, returns `std::true_type` if
the state is resizeable.]]
[[Resizability] [`is_resizeable<State>::value`]
[`bool`]
@@ -242,7 +242,7 @@ sized objects:
template<>
struct is_resizeable< gsl_vector* >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};

View File

@@ -14,7 +14,7 @@
#define VECTOR_VECTOR_RESIZE_HPP
#include <vector>
#include <type_traits>
#include <boost/range.hpp>
namespace boost { namespace numeric { namespace odeint {
@@ -22,7 +22,7 @@ namespace boost { namespace numeric { namespace odeint {
template<>
struct is_resizeable< std::vector< std::vector< double > > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};
@@ -65,7 +65,7 @@ struct state_wrapper< std::vector< std::vector< double > > >
{
typedef std::vector< std::vector< double > > state_type;
typedef state_wrapper< state_type > state_wrapper_type;
typedef boost::true_type is_resizeable;
typedef std::true_type is_resizeable;
state_type m_v;

View File

@@ -24,7 +24,7 @@ namespace boost { namespace numeric { namespace odeint {
template< >
struct is_resizeable< state_type >
{ // declare resizeability
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};

View File

@@ -75,7 +75,7 @@ namespace boost { namespace numeric { namespace odeint {
template<size_t N>
struct is_resizeable< my_vector<N> >
{
typedef boost::true_type type;
typedef std::true_type type;
static const bool value = type::value;
};

View File

@@ -24,6 +24,8 @@
#include <blaze/math/dense/DynamicVector.h>
#include <type_traits>
namespace boost {
namespace numeric {
namespace odeint {
@@ -31,7 +33,7 @@ namespace odeint {
template< typename T , bool TF >
struct is_resizeable< blaze::DynamicVector< T , TF > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};

View File

@@ -22,6 +22,8 @@
#include <boost/numeric/odeint/util/copy.hpp>
#include <type_traits>
namespace boost {
namespace numeric {
namespace odeint {
@@ -29,7 +31,7 @@ namespace odeint {
template< class T, class A >
struct is_resizeable< boost::compute::vector< T , A > >
{
struct type : public boost::true_type { };
struct type : public std::true_type { };
const static bool value = type::value;
};

View File

@@ -24,6 +24,7 @@ copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/numeric/mtl/matrix/dense2D.hpp>
#include <boost/numeric/mtl/matrix/compressed2D.hpp>
#include <type_traits>
namespace boost {
namespace numeric {
@@ -33,21 +34,21 @@ namespace odeint {
template< class Value , class Parameters >
struct is_resizeable< mtl::dense_vector< Value , Parameters > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};
template< class Value , class Parameters >
struct is_resizeable< mtl::dense2D< Value , Parameters > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};
template< class Value , class Parameters >
struct is_resizeable< mtl::compressed2D< Value , Parameters > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};

View File

@@ -13,12 +13,14 @@
#include <boost/numeric/odeint/util/same_size.hpp>
#include <type_traits>
namespace boost { namespace numeric { namespace odeint {
template<typename T, typename S>
struct is_resizeable< nt2::container::table<T,S> >
{
typedef boost::true_type type;
typedef std::true_type type;
static const bool value = type::value;
};

View File

@@ -22,6 +22,7 @@
#include <omp.h>
#include <vector>
#include <algorithm>
#include <type_traits>
#include <boost/range/adaptor/sliced.hpp>
#include <boost/numeric/odeint/util/copy.hpp>
#include <boost/numeric/odeint/util/split.hpp>
@@ -56,7 +57,7 @@ struct openmp_state : public std::vector< std::vector< T > >
template< class T >
struct is_resizeable< openmp_state< T > > : boost::true_type { };
struct is_resizeable< openmp_state< T > > : std::true_type { };
template< class T >

View File

@@ -18,6 +18,8 @@
#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_RESIZE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_EXTERNAL_THRUST_THRUST_RESIZE_HPP_INCLUDED
#include <type_traits>
#include <boost/range.hpp>
#include <thrust/device_vector.h>
@@ -38,7 +40,7 @@ namespace odeint {
template< class T , class A > \
struct is_resizeable< THRUST_VECTOR<T,A> > \
{ \
struct type : public boost::true_type { }; \
struct type : public std::true_type { }; \
const static bool value = type::value; \
}; \

View File

@@ -19,6 +19,8 @@
#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_RESIZE_HPP_INCLUDED
#include <type_traits>
#include <vexcl/vector.hpp>
#include <vexcl/multivector.hpp>
@@ -36,7 +38,7 @@ namespace odeint {
* specializations for vex::vector< T >
*/
template< typename T >
struct is_resizeable< vex::vector< T > > : boost::true_type { };
struct is_resizeable< vex::vector< T > > : std::true_type { };
template< typename T >
struct resize_impl< vex::vector< T > , vex::vector< T > >
@@ -64,7 +66,7 @@ struct same_size_impl< vex::vector< T > , vex::vector< T > >
* specializations for vex::multivector< T >
*/
template< typename T , size_t N >
struct is_resizeable< vex::multivector< T , N > > : boost::true_type { };
struct is_resizeable< vex::multivector< T , N > > : std::true_type { };
template< typename T , size_t N >
struct resize_impl< vex::multivector< T , N > , vex::multivector< T , N > >

View File

@@ -19,6 +19,8 @@
#ifndef BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_EXTERNAL_VIENNACL_VIENNACL_RESIZE_HPP_INCLUDED
#include <type_traits>
#include <viennacl/vector.hpp>
#include <boost/numeric/odeint/util/is_resizeable.hpp>
@@ -35,7 +37,7 @@ namespace odeint {
* specializations for viennacl::vector< T >
*/
template< typename T >
struct is_resizeable< viennacl::vector< T > > : boost::true_type { };
struct is_resizeable< viennacl::vector< T > > : std::true_type { };
template< typename T >
struct resize_impl< viennacl::vector< T > , viennacl::vector< T > >

View File

@@ -20,6 +20,7 @@
#include <vector>
#include <type_traits>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/remove_reference.hpp>
@@ -40,7 +41,7 @@ namespace odeint {
* by default any type is not resizable
*/
template< typename Container , typename Enabler = void >
struct is_resizeable_sfinae : boost::false_type {};
struct is_resizeable_sfinae : std::false_type {};
template< typename Container >
struct is_resizeable : is_resizeable_sfinae< Container > {};
@@ -51,7 +52,7 @@ struct is_resizeable : is_resizeable_sfinae< Container > {};
* specialization for std::vector
*/
template< class V, class A >
struct is_resizeable< std::vector< V , A > > : boost::true_type {};
struct is_resizeable< std::vector< V , A > > : std::true_type {};
/*
@@ -65,7 +66,7 @@ struct is_resizeable_sfinae<
typedef typename boost::mpl::find_if< FusionSequence , is_resizeable< boost::mpl::_1 > >::type iter;
typedef typename boost::mpl::end< FusionSequence >::type last;
typedef typename boost::mpl::if_< boost::is_same< iter , last > , boost::false_type , boost::true_type >::type type;
typedef typename boost::mpl::if_< boost::is_same< iter , last > , std::false_type , std::true_type >::type type;
const static bool value = type::value;
};

View File

@@ -28,6 +28,7 @@
#include <boost/mpl/bool.hpp>
#include <boost/multi_array.hpp>
#include <type_traits>
namespace boost {
namespace numeric {
@@ -36,14 +37,14 @@ namespace odeint {
template< typename T >
struct is_multi_array
{
typedef boost::false_type type;
typedef std::false_type type;
const static bool value = type::value;
};
template< typename T >
struct is_resizeable_multi_array
{
typedef boost::false_type type;
typedef std::false_type type;
const static bool value = type::value;
};
@@ -52,14 +53,14 @@ struct is_resizeable_multi_array
template< typename V , size_t Dim , typename A >
struct is_multi_array< boost::multi_array< V , Dim , A > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};
template< typename V , size_t Dim , typename A >
struct is_resizeable_multi_array< boost::multi_array< V , Dim , A > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};
@@ -69,7 +70,7 @@ struct is_resizeable_multi_array< boost::multi_array< V , Dim , A > >
template< typename T >
struct is_resizeable_sfinae< T , typename boost::enable_if< typename is_resizeable_multi_array< T >::type >::type >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};

View File

@@ -19,6 +19,8 @@
#ifndef BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_UTIL_RESIZE_HPP_INCLUDED
#include <type_traits>
#include <boost/range.hpp>
#include <boost/utility/enable_if.hpp>
@@ -77,13 +79,13 @@ namespace detail {
}
template< class StateOut , class StateIn >
void resize_op( StateOut &x1 , const StateIn &x2 , boost::true_type ) const
void resize_op( StateOut &x1 , const StateIn &x2 , std::true_type ) const
{
resize( x1 , x2 );
}
template< class StateOut , class StateIn >
void resize_op( StateOut &/*x1*/ , const StateIn &/*x2*/ , boost::false_type ) const
void resize_op( StateOut &/*x1*/ , const StateIn &/*x2*/ , std::false_type ) const
{
}

View File

@@ -22,13 +22,14 @@
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/numeric/odeint/util/same_size.hpp>
#include <boost/numeric/odeint/util/resize.hpp>
#include <type_traits>
namespace boost {
namespace numeric {
namespace odeint {
template< class ResizeWrappedState , class State >
bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , boost::true_type )
bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , std::true_type )
{
if ( !same_size( x.m_v , y ) )
{
@@ -40,7 +41,7 @@ bool adjust_size_by_resizeability( ResizeWrappedState &x , const State &y , boos
}
template< class ResizeWrappedState , class State >
bool adjust_size_by_resizeability( ResizeWrappedState & /* x */ , const State & /* y */ , boost::false_type )
bool adjust_size_by_resizeability( ResizeWrappedState & /* x */ , const State & /* y */ , std::false_type )
{
return false;
}

View File

@@ -19,6 +19,8 @@
#ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
#include <type_traits>
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/utility/enable_if.hpp>
@@ -77,13 +79,13 @@ struct same_size_fusion
}
template< class S1 , class S2 >
bool same_size_op( const S1 &x1 , const S2 &x2 , boost::true_type ) const
bool same_size_op( const S1 &x1 , const S2 &x2 , std::true_type ) const
{
return same_size( x1 , x2 );
}
template< class S1 , class S2 >
bool same_size_op( const S1 &/*x1*/ , const S2 &/*x2*/ , boost::false_type ) const
bool same_size_op( const S1 &/*x1*/ , const S2 &/*x2*/ , std::false_type ) const
{
return true;
}

View File

@@ -18,8 +18,8 @@
#ifndef BOOST_NUMERIC_ODEINT_UTIL_UBLAS_WRAPPER_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_UTIL_UBLAS_WRAPPER_HPP_INCLUDED
#include <type_traits>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/lu.hpp>
@@ -171,7 +171,7 @@ namespace odeint {
template< class T , class A >
struct is_resizeable< boost::numeric::ublas::vector< T , A > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};
@@ -182,7 +182,7 @@ struct is_resizeable< boost::numeric::ublas::vector< T , A > >
template< class T , class L , class A >
struct is_resizeable< boost::numeric::ublas::matrix< T , L , A > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};
@@ -193,7 +193,7 @@ struct is_resizeable< boost::numeric::ublas::matrix< T , L , A > >
template< class T , class A >
struct is_resizeable< boost::numeric::ublas::permutation_matrix< T , A > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};

View File

@@ -19,6 +19,8 @@
#define LIBS_NUMERIC_ODEINT_TEST_DIAGNOSTIC_STATE_TYPE_HPP_DEFINED
#include <array>
#include <type_traits>
#include <boost/numeric/odeint/util/is_resizeable.hpp>
#include <boost/numeric/odeint/util/same_size.hpp>
#include <boost/numeric/odeint/util/resize.hpp>
@@ -84,7 +86,7 @@ namespace odeint {
template< size_t N >
struct is_resizeable< diagnostic_type< N > >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};

View File

@@ -22,6 +22,7 @@
#include <utility>
#include <iostream>
#include <vector>
#include <type_traits>
#include <boost/numeric/odeint/stepper/euler.hpp>
#include <boost/numeric/odeint/algebra/range_algebra.hpp>
@@ -55,8 +56,8 @@ namespace odeint {
template<>
struct is_resizeable< my_vec >
{
//struct type : public boost::true_type { };
typedef boost::true_type type;
//struct type : public std::true_type { };
typedef std::true_type type;
const static bool value = type::value;
};
} } }

View File

@@ -23,6 +23,7 @@
#define BOOST_TEST_MODULE odeint_is_resizeable
#include <vector>
#include <type_traits>
#include <cmath>
#include <boost/test/unit_test.hpp>
@@ -44,14 +45,14 @@ template< typename T > struct my_seq2 {};
namespace boost { namespace fusion { namespace traits {
template< typename T > struct is_sequence< my_seq1< T > > : boost::true_type {};
template< typename T > struct is_sequence< my_seq2< T > > : boost::true_type {};
template< typename T > struct is_sequence< my_seq1< T > > : std::true_type {};
template< typename T > struct is_sequence< my_seq2< T > > : std::true_type {};
} } } // boost::fusion::traits
namespace boost { namespace numeric { namespace odeint {
template< typename T >
struct is_resizeable< my_seq2< T > > : boost::true_type {};
struct is_resizeable< my_seq2< T > > : std::true_type {};
} } } // boost::numeric::odeint

View File

@@ -23,7 +23,7 @@
#include <boost/numeric/odeint/util/same_size.hpp>
#include <array>
#include <type_traits>
// Mario: velocity verlet tests need arrays of size 2
@@ -39,7 +39,7 @@ namespace odeint {
template<>
struct is_resizeable< test_array_type >
{
typedef boost::true_type type;
typedef std::true_type type;
const static bool value = type::value;
};