12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
- #define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
- #include <type_traits>
- #include <boost/range/algorithm/copy.hpp>
- #include <boost/utility/enable_if.hpp>
- #include <boost/numeric/odeint/util/detail/is_range.hpp>
- namespace boost {
- namespace numeric {
- namespace odeint {
- namespace detail {
- template< class Container1 , class Container2 >
- void do_copying( const Container1 &from , Container2 &to , std::integral_constant<bool, true>)
- {
- boost::range::copy( from , boost::begin( to ) );
- }
- template< class Container1 , class Container2 >
- void do_copying( const Container1 &from , Container2 &to , std::integral_constant<bool, false>)
- {
- to = from;
- }
- }
- template< class Container1 , class Container2 , class Enabler = void >
- struct copy_impl_sfinae
- {
- static void copy( const Container1 &from , Container2 &to )
- {
- typedef typename boost::numeric::odeint::detail::is_range< Container1 >::type is_range_type;
- detail::do_copying( from , to , is_range_type() );
- }
- };
- template< class Container1, class Container2 >
- struct copy_impl
- {
- static void copy( const Container1 &from , Container2 &to )
- {
- copy_impl_sfinae< Container1 , Container2 >::copy( from , to );
- }
- };
- template< class Container1 , class Container2 >
- void copy( const Container1 &from , Container2 &to )
- {
- copy_impl< Container1 , Container2 >::copy( from , to );
- }
- }
- }
- }
- #endif
|