mirror of
https://github.com/boostorg/python.git
synced 2026-01-27 07:02:15 +00:00
class.hpp, object/select_holder.hpp, object/pointer_holder.hpp -
fix a problem which was causing value_holder<T> to be instantiated on abstract classes. Now we compute the held_type at an outer level thereby avoiding the inner instantiation. object_core.hpp - workarounds for GCC 2.x bugs suite/indexing/detail/indexing_suite_detail.hpp - workaround for a CWPro8 bug [SVN r19635]
This commit is contained in:
@@ -585,19 +585,14 @@ inline void class_<T,X1,X2,X3>::register_() const
|
||||
objects::register_class_from_python<T,bases>();
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME holder_selector::type select_holder;
|
||||
typedef BOOST_DEDUCED_TYPENAME select_holder::type holder;
|
||||
typedef BOOST_DEDUCED_TYPENAME holder::held_type held_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME select_holder::held_type held_t;
|
||||
|
||||
detail::register_wrapper_class<held_t,T>();
|
||||
|
||||
detail::register_class_to_python<T>(
|
||||
mpl::bool_<is_copyable>()
|
||||
# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
, holder_selector::execute((held_type*)0)
|
||||
# else
|
||||
, BOOST_DEDUCED_TYPENAME holder_selector::type()
|
||||
# endif
|
||||
);
|
||||
, BOOST_DEDUCED_TYPENAME holder_selector::type()
|
||||
);
|
||||
}
|
||||
|
||||
template <class T, class X1, class X2, class X3>
|
||||
@@ -606,11 +601,7 @@ inline class_<T,X1,X2,X3>::class_(char const* name, char const* doc)
|
||||
{
|
||||
this->register_();
|
||||
this->set_instance_size(holder_selector::additional_size());
|
||||
# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
holder_selector::execute((held_type*)0).assert_default_constructible();
|
||||
# else
|
||||
holder_selector::type::assert_default_constructible();
|
||||
# endif
|
||||
this->def(init<>());
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ bool is_null(T* p, int)
|
||||
template <class Pointer, class Value>
|
||||
struct pointer_holder : instance_holder
|
||||
{
|
||||
typedef Value held_type;
|
||||
typedef Value value_type;
|
||||
|
||||
pointer_holder(Pointer);
|
||||
@@ -75,6 +74,7 @@ template <class Pointer, class Value>
|
||||
struct pointer_holder_back_reference : instance_holder
|
||||
{
|
||||
typedef typename python::pointee<Pointer>::type held_type;
|
||||
private:
|
||||
typedef Value value_type;
|
||||
|
||||
// Not sure about this one -- can it work? The source object
|
||||
|
||||
@@ -109,6 +109,8 @@ namespace detail
|
||||
, value_holder<T>
|
||||
>::type type;
|
||||
|
||||
typedef Held held_type;
|
||||
|
||||
static inline void register_() {}
|
||||
|
||||
static type* get() { return 0; }
|
||||
@@ -136,6 +138,8 @@ namespace detail
|
||||
, pointer_holder<Ptr,T>
|
||||
>::type type;
|
||||
|
||||
typedef typename pointee<Ptr>::type held_type;
|
||||
|
||||
static inline void register_()
|
||||
{
|
||||
select_pointer_holder::register_(use_back_ref());
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_convertible.hpp>
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
# include <boost/type_traits/add_pointer.hpp>
|
||||
@@ -217,6 +218,7 @@ namespace api
|
||||
PyObject* m_ptr;
|
||||
};
|
||||
|
||||
# if BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class T, class U>
|
||||
struct is_derived_impl
|
||||
{
|
||||
@@ -235,26 +237,51 @@ namespace api
|
||||
struct is_derived
|
||||
: mpl::bool_<is_derived_impl<T,U>::value>
|
||||
{};
|
||||
# else
|
||||
template <class T, class U>
|
||||
struct is_derived
|
||||
: is_convertible<
|
||||
typename remove_reference<T>::type*
|
||||
, U const*
|
||||
>
|
||||
{};
|
||||
# endif
|
||||
|
||||
template <class T>
|
||||
typename objects::unforward_cref<T>::type do_unforward_cref(T const& x)
|
||||
{
|
||||
# if BOOST_WORKAROUND(__GNUC__, == 2)
|
||||
typedef typename objects::unforward_cref<T>::type ret;
|
||||
return ret(x);
|
||||
# else
|
||||
return x;
|
||||
# endif
|
||||
}
|
||||
|
||||
# if BOOST_WORKAROUND(__GNUC__, == 2)
|
||||
// GCC 2.x has non-const string literals; this hacks around that problem.
|
||||
template <unsigned N>
|
||||
char const (& do_unforward_cref(char const(&x)[N]) )[N]
|
||||
{
|
||||
return x;
|
||||
}
|
||||
# endif
|
||||
|
||||
class object;
|
||||
|
||||
template <class T>
|
||||
PyObject* object_base_initializer(T const& x)
|
||||
{
|
||||
typedef typename is_derived<
|
||||
BOOST_DEDUCED_TYPENAME objects::unforward_cref<T>::type
|
||||
, object
|
||||
>::type is_obj;
|
||||
|
||||
return object_initializer<
|
||||
BOOST_DEDUCED_TYPENAME unwrap_reference<T>::type
|
||||
>::get(
|
||||
api::do_unforward_cref(x)
|
||||
, is_derived<
|
||||
BOOST_DEDUCED_TYPENAME objects::unforward_cref<T>::type
|
||||
, object
|
||||
>()
|
||||
, is_obj()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,12 +168,12 @@ namespace boost { namespace python { namespace detail {
|
||||
|
||||
while (right != proxies.end())
|
||||
{
|
||||
typedef typename Proxy::container_type::difference_type difference_type;
|
||||
extract<Proxy&> p(*right);
|
||||
p().set_index(
|
||||
extract<Proxy&>(*right)().get_index()
|
||||
- (typename Proxy::container_type::difference_type(to)
|
||||
- from - len)
|
||||
);
|
||||
- (difference_type(to) - from - len)
|
||||
);
|
||||
|
||||
++right;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user