Chris@16: /* Chris@16: [auto_generated] Chris@16: boost/numeric/odeint/util/copy.hpp Chris@16: Chris@16: [begin_description] Chris@16: Copy abstraction for the usage in the steppers. Chris@16: [end_description] Chris@16: Chris@101: Copyright 2011-2012 Karsten Ahnert Chris@101: Copyright 2011-2012 Mario Mulansky Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. Chris@16: (See accompanying file LICENSE_1_0.txt or Chris@16: copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: */ Chris@16: Chris@16: Chris@16: #ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED Chris@16: #define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED Chris@16: Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace numeric { Chris@16: namespace odeint { Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: template< class Container1 , class Container2 > Chris@16: void do_copying( const Container1 &from , Container2 &to , boost::mpl::true_ ) Chris@16: { Chris@16: boost::range::copy( from , boost::begin( to ) ); Chris@16: } Chris@16: Chris@16: template< class Container1 , class Container2 > Chris@16: void do_copying( const Container1 &from , Container2 &to , boost::mpl::false_ ) Chris@16: { Chris@16: to = from; Chris@16: } Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: Chris@101: Chris@16: /* Chris@16: * Default implementation of the copy operation used the assign operator Chris@16: * gsl_vector must copied differently Chris@16: */ Chris@101: template< class Container1 , class Container2 , class Enabler = void > Chris@101: struct copy_impl_sfinae Chris@16: { Chris@16: static void copy( const Container1 &from , Container2 &to ) Chris@16: { Chris@16: typedef typename boost::numeric::odeint::detail::is_range< Container1 >::type is_range_type; Chris@16: detail::do_copying( from , to , is_range_type() ); Chris@16: } Chris@101: Chris@16: }; Chris@16: Chris@101: template< class Container1, class Container2 > Chris@101: struct copy_impl Chris@101: { Chris@101: static void copy( const Container1 &from , Container2 &to ) Chris@101: { Chris@101: copy_impl_sfinae< Container1 , Container2 >::copy( from , to ); Chris@101: } Chris@101: }; Chris@101: Chris@101: // ToDo: allow also to copy INTO a range, not only from a range! Needs "const Container2 &to" Chris@16: template< class Container1 , class Container2 > Chris@16: void copy( const Container1 &from , Container2 &to ) Chris@16: { Chris@16: copy_impl< Container1 , Container2 >::copy( from , to ); Chris@16: } Chris@16: Chris@16: Chris@16: } // namespace odeint Chris@16: } // namespace numeric Chris@16: } // namespace boost Chris@16: Chris@16: Chris@16: #endif // BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED