1 | *** pointer_holder.hpp.orig 2006-11-24 22:39:59.000000000 +0200
|
---|
2 | --- pointer_holder.hpp 2006-12-08 20:05:58.000000000 +0200
|
---|
3 | ***************
|
---|
4 | *** 35,40 ****
|
---|
5 | --- 35,42 ----
|
---|
6 |
|
---|
7 | # include <boost/detail/workaround.hpp>
|
---|
8 |
|
---|
9 | + # include <boost/type_traits/remove_const.hpp>
|
---|
10 | +
|
---|
11 | namespace boost { namespace python {
|
---|
12 |
|
---|
13 | template <class T> class wrapper;
|
---|
14 | ***************
|
---|
15 | *** 122,146 ****
|
---|
16 | template <class Pointer, class Value>
|
---|
17 | void* pointer_holder<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only)
|
---|
18 | {
|
---|
19 | if (dst_t == python::type_id<Pointer>()
|
---|
20 | && !(null_ptr_only && get_pointer(this->m_p))
|
---|
21 | )
|
---|
22 | return &this->m_p;
|
---|
23 | !
|
---|
24 | ! Value* p = get_pointer(this->m_p);
|
---|
25 | if (p == 0)
|
---|
26 | return 0;
|
---|
27 |
|
---|
28 | if (void* wrapped = holds_wrapped(dst_t, p, p))
|
---|
29 | return wrapped;
|
---|
30 |
|
---|
31 | ! type_info src_t = python::type_id<Value>();
|
---|
32 | return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t);
|
---|
33 | }
|
---|
34 |
|
---|
35 | template <class Pointer, class Value>
|
---|
36 | void* pointer_holder_back_reference<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only)
|
---|
37 | {
|
---|
38 | if (dst_t == python::type_id<Pointer>()
|
---|
39 | && !(null_ptr_only && get_pointer(this->m_p))
|
---|
40 | )
|
---|
41 | --- 124,153 ----
|
---|
42 | template <class Pointer, class Value>
|
---|
43 | void* pointer_holder<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only)
|
---|
44 | {
|
---|
45 | + typedef typename boost::remove_const< Value >::type NonConstValue;
|
---|
46 | +
|
---|
47 | if (dst_t == python::type_id<Pointer>()
|
---|
48 | && !(null_ptr_only && get_pointer(this->m_p))
|
---|
49 | )
|
---|
50 | return &this->m_p;
|
---|
51 | !
|
---|
52 | ! Value* tmp = get_pointer(this->m_p);
|
---|
53 | ! NonConstValue* p = const_cast<NonConstValue*>( tmp );
|
---|
54 | if (p == 0)
|
---|
55 | return 0;
|
---|
56 |
|
---|
57 | if (void* wrapped = holds_wrapped(dst_t, p, p))
|
---|
58 | return wrapped;
|
---|
59 |
|
---|
60 | ! type_info src_t = python::type_id<NonConstValue>();
|
---|
61 | return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t);
|
---|
62 | }
|
---|
63 |
|
---|
64 | template <class Pointer, class Value>
|
---|
65 | void* pointer_holder_back_reference<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only)
|
---|
66 | {
|
---|
67 | + typedef typename boost::remove_const< Value >::type NonConstValue;
|
---|
68 | +
|
---|
69 | if (dst_t == python::type_id<Pointer>()
|
---|
70 | && !(null_ptr_only && get_pointer(this->m_p))
|
---|
71 | )
|
---|
72 | ***************
|
---|
73 | *** 149,160 ****
|
---|
74 | if (!get_pointer(this->m_p))
|
---|
75 | return 0;
|
---|
76 |
|
---|
77 | ! Value* p = get_pointer(m_p);
|
---|
78 |
|
---|
79 | if (dst_t == python::type_id<held_type>())
|
---|
80 | return p;
|
---|
81 |
|
---|
82 | ! type_info src_t = python::type_id<Value>();
|
---|
83 | return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t);
|
---|
84 | }
|
---|
85 |
|
---|
86 | --- 156,168 ----
|
---|
87 | if (!get_pointer(this->m_p))
|
---|
88 | return 0;
|
---|
89 |
|
---|
90 | ! Value* tmp = get_pointer(this->m_p);
|
---|
91 | ! NonConstValue* p = const_cast<NonConstValue*>( tmp );
|
---|
92 |
|
---|
93 | if (dst_t == python::type_id<held_type>())
|
---|
94 | return p;
|
---|
95 |
|
---|
96 | ! type_info src_t = python::type_id<NonConstValue>();
|
---|
97 | return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t);
|
---|
98 | }
|
---|
99 |
|
---|