3 boost/numeric/odeint/util/copy.hpp
6 Copy abstraction for the usage in the steppers.
9 Copyright 2011-2012 Karsten Ahnert
10 Copyright 2011-2012 Mario Mulansky
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED
22 #include <boost/range/algorithm/copy.hpp>
24 #include <boost/utility/enable_if.hpp>
26 #include <boost/numeric/odeint/util/detail/is_range.hpp>
34 template< class Container1 , class Container2 >
35 void do_copying( const Container1 &from , Container2 &to , boost::mpl::true_ )
37 boost::range::copy( from , boost::begin( to ) );
40 template< class Container1 , class Container2 >
41 void do_copying( const Container1 &from , Container2 &to , boost::mpl::false_ )
51 * Default implementation of the copy operation used the assign operator
52 * gsl_vector must copied differently
54 template< class Container1 , class Container2 , class Enabler = void >
55 struct copy_impl_sfinae
57 static void copy( const Container1 &from , Container2 &to )
59 typedef typename boost::numeric::odeint::detail::is_range< Container1 >::type is_range_type;
60 detail::do_copying( from , to , is_range_type() );
65 template< class Container1, class Container2 >
68 static void copy( const Container1 &from , Container2 &to )
70 copy_impl_sfinae< Container1 , Container2 >::copy( from , to );
74 // ToDo: allow also to copy INTO a range, not only from a range! Needs "const Container2 &to"
75 template< class Container1 , class Container2 >
76 void copy( const Container1 &from , Container2 &to )
78 copy_impl< Container1 , Container2 >::copy( from , to );
83 } // namespace numeric
87 #endif // BOOST_NUMERIC_ODEINT_UTIL_COPY_HPP_INCLUDED