1 /*
2  [auto_generated]
3  boost/numeric/odeint/util/same_instance.hpp
4 
5  [begin_description]
6  Basic check if two variables are the same instance
7  [end_description]
8 
9  Copyright 2012 Karsten Ahnert
10  Copyright 2012 Mario Mulansky
11 
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)
15  */
16 
17 
18 #ifndef BOOST_NUMERIC_ODEINT_UTIL_SAME_INSTANCE_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_UTIL_SAME_INSTANCE_HPP_INCLUDED
20 
21 namespace boost {
22 namespace numeric {
23 namespace odeint {
24 
25 template< class T1 , class T2 , class Enabler=void >
26 struct same_instance_impl
27 {
same_instanceboost::numeric::odeint::same_instance_impl28     static bool same_instance( const T1& /* x1 */ , const T2& /* x2 */ )
29     {
30         return false;
31     }
32 };
33 
34 template< class T >
35 struct same_instance_impl< T , T >
36 {
same_instanceboost::numeric::odeint::same_instance_impl37     static bool same_instance( const T &x1 , const T &x2 )
38     {
39         // check pointers
40         return (&x1 == &x2);
41     }
42 };
43 
44 
45 template< class T1 , class T2 >
same_instance(const T1 & x1,const T2 & x2)46 bool same_instance( const T1 &x1 , const T2 &x2 )
47 {
48     return same_instance_impl< T1 , T2 >::same_instance( x1 , x2 );
49 }
50 
51 
52 } // namespace odeint
53 } // namespace numeric
54 } // namespace boost
55 
56 #endif
57