mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 17:32:55 +00:00
Fixes for auto_ptr handling
[SVN r22490]
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/python/detail/not_specified.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
@@ -51,10 +52,6 @@ namespace detail
|
||||
template <class Data, class Class>
|
||||
struct member
|
||||
{
|
||||
private:
|
||||
typedef typename add_const<Data>::type data_const;
|
||||
typedef typename add_reference<data_const>::type data_cref;
|
||||
|
||||
public:
|
||||
member(Data Class::*which) : m_which(which) {}
|
||||
|
||||
@@ -63,7 +60,7 @@ namespace detail
|
||||
return c.*m_which;
|
||||
}
|
||||
|
||||
void operator()(Class& c, data_cref d) const
|
||||
void operator()(Class& c, typename value_arg<Data>::type d) const
|
||||
{
|
||||
c.*m_which = d;
|
||||
}
|
||||
@@ -76,10 +73,6 @@ namespace detail
|
||||
template <class Data>
|
||||
struct datum
|
||||
{
|
||||
private:
|
||||
typedef typename add_const<Data>::type data_const;
|
||||
typedef typename add_reference<data_const>::type data_cref;
|
||||
|
||||
public:
|
||||
datum(Data *which) : m_which(which) {}
|
||||
|
||||
@@ -88,7 +81,7 @@ namespace detail
|
||||
return *m_which;
|
||||
}
|
||||
|
||||
void operator()(data_cref d) const
|
||||
void operator()(typename value_arg<Data>::type d) const
|
||||
{
|
||||
*m_which = d;
|
||||
}
|
||||
@@ -112,11 +105,11 @@ namespace detail
|
||||
: mpl::and_<
|
||||
mpl::bool_<
|
||||
to_python_value<
|
||||
typename add_reference<typename add_const<T>::type>::type
|
||||
typename value_arg<T>::type
|
||||
>::uses_registry
|
||||
>
|
||||
, is_reference_to_class<
|
||||
typename add_reference<typename add_const<T>::type>::type
|
||||
typename value_arg<T>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_value.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -53,14 +57,12 @@ struct default_result_converter
|
||||
template <class R>
|
||||
struct apply
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, is_illegal = is_reference<R>::value || is_pointer<R>::value);
|
||||
|
||||
typedef typename mpl::if_c<
|
||||
is_illegal
|
||||
, detail::specify_a_return_value_policy_to_wrap_functions_returning<R>
|
||||
, boost::python::to_python_value<
|
||||
typename add_reference<typename add_const<R>::type>::type
|
||||
>
|
||||
typedef typename mpl::if_<
|
||||
mpl::or_<is_pointer<R>, is_reference<R> >
|
||||
, detail::specify_a_return_value_policy_to_wrap_functions_returning<R>
|
||||
, boost::python::to_python_value<
|
||||
typename detail::value_arg<R>::type
|
||||
>
|
||||
>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,10 +11,14 @@
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/ref.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
# include <boost/python/detail/copy_ctor_mutates_rhs.hpp>
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, == 1200)
|
||||
# include <boost/type_traits/is_enum.hpp>
|
||||
# include <boost/mpl/and.hpp>
|
||||
# include <boost/mpl/not.hpp>
|
||||
# else
|
||||
# include <boost/mpl/or.hpp>
|
||||
# endif
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
@@ -48,7 +52,7 @@ struct forward
|
||||
>
|
||||
>
|
||||
# else
|
||||
is_scalar<T>
|
||||
mpl::or_<python::detail::copy_ctor_mutates_rhs<T>, is_scalar<T> >
|
||||
# endif
|
||||
, T
|
||||
, reference_to_value<T>
|
||||
@@ -71,10 +75,8 @@ struct unforward<reference_to_value<T> >
|
||||
|
||||
template <typename T>
|
||||
struct unforward_cref
|
||||
: add_reference<
|
||||
typename add_const<
|
||||
typename unwrap_reference<T>::type
|
||||
>::type
|
||||
: python::detail::value_arg<
|
||||
typename unwrap_reference<T>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
@@ -122,10 +124,8 @@ namespace detail
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
: add_reference<
|
||||
typename add_const<
|
||||
typename unwrap_reference<T>::type
|
||||
>::type
|
||||
: python::detail::value_arg<
|
||||
typename unwrap_reference<T>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
@@ -136,11 +136,9 @@ namespace detail
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
: add_reference<
|
||||
typename add_const<
|
||||
typename T::reference
|
||||
>::type
|
||||
>
|
||||
: python::detail::value_arg<
|
||||
typename T::reference
|
||||
>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
@@ -176,6 +176,8 @@ namespace api
|
||||
# endif
|
||||
|
||||
private: // def visitation for adding callable objects as class methods
|
||||
using def_visitor<U>::visit;
|
||||
|
||||
template <class ClassT, class DocStringT>
|
||||
void visit(ClassT& cl, char const* name, python::detail::def_helper<DocStringT> const& helper) const
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
# define RETURN_ARG_DWA2003719_HPP
|
||||
# include <boost/python/default_call_policies.hpp>
|
||||
# include <boost/python/detail/none.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
@@ -40,11 +41,7 @@ namespace detail
|
||||
return true;
|
||||
}
|
||||
|
||||
PyObject *operator()(
|
||||
typename add_reference<
|
||||
typename add_const<T>::type
|
||||
>::type
|
||||
) const
|
||||
PyObject *operator()( typename value_arg<T>::type ) const
|
||||
{
|
||||
return none();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
struct return_by_value
|
||||
@@ -20,9 +22,7 @@ struct return_by_value
|
||||
struct apply
|
||||
{
|
||||
typedef to_python_value<
|
||||
typename add_reference<
|
||||
typename add_const<R>::type
|
||||
>::type
|
||||
typename detail::value_arg<R>::type
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
# include <boost/python/converter/shared_ptr_to_python.hpp>
|
||||
|
||||
# include <boost/python/detail/value_is_shared_ptr.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
|
||||
@@ -32,9 +33,7 @@ namespace detail
|
||||
template <class T>
|
||||
struct object_manager_to_python_value
|
||||
{
|
||||
typedef typename add_reference<
|
||||
typename add_const<T>::type
|
||||
>::type argument_type;
|
||||
typedef typename value_arg<T>::type argument_type;
|
||||
|
||||
PyObject* operator()(argument_type) const;
|
||||
|
||||
@@ -48,9 +47,7 @@ namespace detail
|
||||
template <class T>
|
||||
struct registry_to_python_value
|
||||
{
|
||||
typedef typename add_reference<
|
||||
typename add_const<T>::type
|
||||
>::type argument_type;
|
||||
typedef typename value_arg<T>::type argument_type;
|
||||
|
||||
PyObject* operator()(argument_type) const;
|
||||
|
||||
@@ -63,9 +60,7 @@ namespace detail
|
||||
template <class T>
|
||||
struct shared_ptr_to_python_value
|
||||
{
|
||||
typedef typename add_reference<
|
||||
typename add_const<T>::type
|
||||
>::type argument_type;
|
||||
typedef typename value_arg<T>::type argument_type;
|
||||
|
||||
PyObject* operator()(argument_type) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user