• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright David Abrahams 2004. Distributed under the Boost
2 // Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 #include <boost/python/converter/arg_to_python.hpp>
5 #include <boost/python/type_id.hpp>
6 #include <boost/python/handle.hpp>
7 #include <boost/python/object.hpp>
8 #include <iostream>
9 
10 // gcc 2.95.x and MIPSpro 7.3.1.3 linker seem to demand this definition
11 #if ((defined(__GNUC__) && __GNUC__ < 3)) \
12  || (defined(__sgi) && defined(__EDG_VERSION__) && (__EDG_VERSION__ == 238))
13 namespace boost { namespace python {
handle_exception_impl(function0<void>)14 BOOST_PYTHON_DECL bool handle_exception_impl(function0<void>)
15 {
16     return true;
17 }
18 }}
19 #endif
20 
21 int result;
22 
23 #define ASSERT_SAME(T1,T2) assert_same< T1,T2 >()
24 
25 template <class T, class U>
assert_same(U * =0,T * =0)26 void assert_same(U* = 0, T* = 0)
27 {
28     BOOST_STATIC_ASSERT((boost::is_same<T,U>::value));
29 
30 }
31 
32 
main()33 int main()
34 {
35     using namespace boost::python::converter::detail;
36     using namespace boost::python::converter;
37     using namespace boost::python;
38     using namespace boost;
39 
40 
41     ASSERT_SAME(
42         select_arg_to_python<int>::type, value_arg_to_python<int>
43         );
44 
45     ASSERT_SAME(
46         select_arg_to_python<reference_wrapper<int> >::type, reference_arg_to_python<int>
47         );
48 
49     ASSERT_SAME(
50         select_arg_to_python<pointer_wrapper<int> >::type, pointer_shallow_arg_to_python<int>
51         );
52 
53     ASSERT_SAME(
54         select_arg_to_python<int*>::type, pointer_deep_arg_to_python<int*>
55         );
56 
57     ASSERT_SAME(
58         select_arg_to_python<handle<> >::type, object_manager_arg_to_python<handle<> >
59         );
60 
61     ASSERT_SAME(
62         select_arg_to_python<object>::type, object_manager_arg_to_python<object>
63         );
64 
65     ASSERT_SAME(
66         select_arg_to_python<char[20]>::type, arg_to_python<char const*>
67         );
68 
69     return result;
70 }
71