File indexing completed on 2025-06-30 08:21:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
0019 #define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
0020
0021 #include <type_traits>
0022
0023 #include <boost/range/algorithm/copy.hpp>
0024
0025 #include <boost/utility/enable_if.hpp>
0026
0027 #include <boost/numeric/odeint/util/detail/is_range.hpp>
0028
0029 namespace boost {
0030 namespace numeric {
0031 namespace odeint {
0032
0033 namespace detail {
0034
0035 template< class Container1 , class Container2 >
0036 void do_copying( const Container1 &from , Container2 &to , std::integral_constant<bool, true>)
0037 {
0038 boost::range::copy( from , boost::begin( to ) );
0039 }
0040
0041 template< class Container1 , class Container2 >
0042 void do_copying( const Container1 &from , Container2 &to , std::integral_constant<bool, false>)
0043 {
0044 to = from;
0045 }
0046
0047 }
0048
0049
0050
0051
0052
0053
0054
0055 template< class Container1 , class Container2 , class Enabler = void >
0056 struct copy_impl_sfinae
0057 {
0058 static void copy( const Container1 &from , Container2 &to )
0059 {
0060 typedef typename boost::numeric::odeint::detail::is_range< Container1 >::type is_range_type;
0061 detail::do_copying( from , to , is_range_type() );
0062 }
0063
0064 };
0065
0066 template< class Container1, class Container2 >
0067 struct copy_impl
0068 {
0069 static void copy( const Container1 &from , Container2 &to )
0070 {
0071 copy_impl_sfinae< Container1 , Container2 >::copy( from , to );
0072 }
0073 };
0074
0075
0076 template< class Container1 , class Container2 >
0077 void copy( const Container1 &from , Container2 &to )
0078 {
0079 copy_impl< Container1 , Container2 >::copy( from , to );
0080 }
0081
0082
0083 }
0084 }
0085 }
0086
0087
0088 #endif