Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 08:21:38

0001 /*
0002  [auto_generated]
0003  boost/numeric/odeint/util/state_wrapper.hpp
0004 
0005  [begin_description]
0006  State wrapper for the state type in all stepper. The state wrappers are responsible for construction,
0007  destruction, copying construction, assignment and resizing.
0008  [end_description]
0009 
0010  Copyright 2011-2013 Karsten Ahnert
0011  Copyright 2011 Mario Mulansky
0012 
0013  Distributed under the Boost Software License, Version 1.0.
0014  (See accompanying file LICENSE_1_0.txt or
0015  copy at http://www.boost.org/LICENSE_1_0.txt)
0016  */
0017 
0018 
0019 #ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
0020 #define BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED
0021 
0022 #include <type_traits>
0023 
0024 #include <boost/numeric/odeint/util/is_resizeable.hpp>
0025 
0026 #include <boost/utility/enable_if.hpp>
0027 #include <boost/fusion/include/is_sequence.hpp>
0028 #include <boost/fusion/include/zip_view.hpp>
0029 #include <boost/fusion/include/vector.hpp>
0030 #include <boost/fusion/include/make_fused.hpp>
0031 #include <boost/fusion/include/all.hpp>
0032 
0033 #include <boost/range.hpp>
0034 
0035 
0036 namespace boost {
0037 namespace numeric {
0038 namespace odeint {
0039     
0040 template< typename State1 , typename State2 , class Enabler = void >
0041 struct same_size_impl_sfinae
0042 {
0043     static bool same_size( const State1 &x1 , const State2 &x2 )
0044     {
0045         return ( boost::size( x1 ) == boost::size( x2 ) );
0046     }
0047 
0048 };
0049 
0050 // same_size function
0051 // standard implementation relies on boost.range
0052 template< class State1 , class State2 >
0053 struct same_size_impl
0054 {
0055     static bool same_size( const State1 &x1 , const State2 &x2 )
0056     {
0057         return same_size_impl_sfinae< State1 , State2 >::same_size( x1 , x2 );
0058     }
0059 };
0060 
0061 
0062 // do not overload or specialize this function, specialize resize_impl<> instead
0063 template< class State1 , class State2 >
0064 bool same_size( const State1 &x1 , const State2 &x2 )
0065 {
0066     return same_size_impl< State1 , State2 >::same_size( x1 , x2 );
0067 }
0068 
0069 namespace detail {
0070 
0071 struct same_size_fusion
0072 {
0073     typedef bool result_type;
0074 
0075     template< class S1 , class S2 >
0076     bool operator()( const S1 &x1 , const S2 &x2 ) const
0077     {
0078         return same_size_op( x1 , x2 , typename is_resizeable< S1 >::type() );
0079     }
0080 
0081     template< class S1 , class S2 >
0082     bool same_size_op( const S1 &x1 , const S2 &x2 , std::true_type ) const
0083     {
0084         return same_size( x1 , x2 );
0085     }
0086 
0087     template< class S1 , class S2 >
0088     bool same_size_op( const S1 &/*x1*/ , const S2 &/*x2*/ , std::false_type ) const
0089     {
0090         return true;
0091     }
0092 };
0093 
0094 } // namespace detail
0095 
0096 
0097 
0098 template< class FusionSeq >
0099 struct same_size_impl_sfinae< FusionSeq , FusionSeq , typename boost::enable_if< typename boost::fusion::traits::is_sequence< FusionSeq >::type >::type >
0100 {
0101     static bool same_size( const FusionSeq &x1 , const FusionSeq &x2 )
0102     {
0103         typedef boost::fusion::vector< const FusionSeq& , const FusionSeq& > Sequences;
0104         Sequences sequences( x1 , x2 );
0105         return boost::fusion::all( boost::fusion::zip_view< Sequences >( sequences ) ,
0106                                    boost::fusion::make_fused( detail::same_size_fusion() ) );
0107     }
0108 };
0109 
0110 
0111 }
0112 }
0113 }
0114 
0115 
0116 
0117 #endif // BOOST_NUMERIC_ODEINT_UTIL_SAME_SIZE_HPP_INCLUDED