Skip to content

Commit e9519db

Browse files
committed
Make Dereferenceable use get_pointer
Re-enable map_indexing_suite iteration for vc6. [SVN r21008]
1 parent dd7a24e commit e9519db

File tree

6 files changed

+41
-16
lines changed

6 files changed

+41
-16
lines changed

doc/v2/Dereferenceable.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ <h3><a name="Dereferenceable-concept"></a>Dereferenceable Concept</h3>
5959
</tr>
6060

6161
<tr>
62-
<td valign="top"><code>x.get()</code></td>
62+
<td valign="top"><code>get_pointer( x )</code></td>
6363
<td><code>&amp;*x</code>, or a null pointer
6464
</tr>
6565
</table>

include/boost/python/handle.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,19 @@ class handle
137137
T* m_p;
138138
};
139139

140+
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
141+
} // namespace python
142+
#endif
143+
144+
template<class T> inline T * get_pointer(python::handle<T> const & p)
145+
{
146+
return p.get();
147+
}
148+
149+
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
150+
namespace python {
151+
#endif
152+
140153
typedef handle<PyTypeObject> type_handle;
141154

142155
//

include/boost/python/object/make_ptr_instance.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@
1010
# include <boost/python/converter/registry.hpp>
1111
# include <boost/type_traits/is_polymorphic.hpp>
1212
# include <boost/get_pointer.hpp>
13+
# include <boost/detail/workaround.hpp>
1314
# include <typeinfo>
1415

1516
namespace boost { namespace python { namespace objects {
1617

18+
# if BOOST_WORKAROUND(__GNUC__, == 2)
19+
// A weird ADL bug prevents this being found
20+
template<class T> T * get_pointer(T * p)
21+
{
22+
return p;
23+
}
24+
# endif
25+
1726
template <class T, class Holder>
1827
struct make_ptr_instance
1928
: make_instance_impl<T, Holder, make_ptr_instance<T,Holder> >
@@ -27,6 +36,7 @@ struct make_ptr_instance
2736
template <class Ptr>
2837
static inline PyTypeObject* get_class_object(Ptr const& x)
2938
{
39+
using ::boost::get_pointer;
3040
return get_class_object_impl(get_pointer(x));
3141
}
3242

include/boost/python/object/pointer_holder.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# ifndef POINTER_HOLDER_DWA20011215_HPP
1010
# define POINTER_HOLDER_DWA20011215_HPP
1111

12+
# include <boost/get_pointer.hpp>
1213
# include <boost/type.hpp>
1314

1415
# include <boost/python/instance_holder.hpp>
@@ -34,7 +35,7 @@ namespace boost { namespace python { namespace objects {
3435
template <class T>
3536
bool is_null(T const& p, ...)
3637
{
37-
return p.get() == 0;
38+
return get_pointer(p) == 0;
3839
}
3940

4041
template <class T>

include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
# include <boost/python/extract.hpp>
1111
# include <boost/scoped_ptr.hpp>
12-
# include <boost/detail/binary_search.hpp>
1312
# include <boost/get_pointer.hpp>
13+
# include <boost/detail/binary_search.hpp>
1414
# include <vector>
1515
# include <map>
1616

@@ -366,9 +366,9 @@ namespace boost { namespace python { namespace detail {
366366
}
367367

368368
container_element(container_element const& ce)
369-
: ptr(ce.ptr.get() == 0 ? 0 : new element_type(*ce.ptr.get()))
370-
, container(ce.container)
371-
, index(ce.index)
369+
: ptr(ce.ptr.get() == 0 ? 0 : new element_type(*ce.ptr.get()))
370+
, container(ce.container)
371+
, index(ce.index)
372372
{
373373
}
374374

@@ -381,14 +381,14 @@ namespace boost { namespace python { namespace detail {
381381
element_type& operator*() const
382382
{
383383
if (is_detached())
384-
return *ptr.get();
384+
return *get_pointer(ptr);
385385
return Policies::get_item(get_container(), index);
386386
}
387387

388388
element_type* get() const
389389
{
390390
if (is_detached())
391-
return ptr.get();
391+
return get_pointer(ptr);
392392
return &Policies::get_item(get_container(), index);
393393
}
394394

@@ -407,7 +407,7 @@ namespace boost { namespace python { namespace detail {
407407
bool
408408
is_detached() const
409409
{
410-
return ptr.get() != 0;
410+
return get_pointer(ptr) != 0;
411411
}
412412

413413
Container&
@@ -690,7 +690,9 @@ namespace boost { namespace python { namespace detail {
690690
}
691691
};
692692

693-
}} // namespace python::detail
693+
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
694+
}} // namespace python::detail
695+
#endif
694696

695697
template <class Container, class Index, class Policies>
696698
inline typename Policies::data_type*
@@ -701,6 +703,11 @@ namespace boost { namespace python { namespace detail {
701703
return p.get();
702704
}
703705

706+
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
707+
namespace python { namespace detail {
708+
#endif
709+
710+
}} // namespace python::detail
704711
} // namespace boost
705712

706713
#endif // INDEXING_SUITE_DETAIL_JDG20036_HPP

include/boost/python/suite/indexing/indexing_suite.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,7 @@ namespace boost { namespace python {
182182
.def("__delitem__", &base_delete_item)
183183
.def("__getitem__", &base_get_item)
184184
.def("__contains__", &base_contains)
185-
186-
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200
187-
// crazy VC6 doesn't like this! perhaps there's a better
188-
// fix but this one will do for now. def __iter__ is just
189-
// an optimization anyway.
190185
.def("__iter__", def_iterator())
191-
#endif
192186
;
193187

194188
DerivedPolicies::extension_def(cl);

0 commit comments

Comments
 (0)