2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-26 06:42:27 +00:00

Fix to allow accessing enums as data members

[SVN r16656]
This commit is contained in:
Dave Abrahams
2002-12-18 21:11:16 +00:00
parent 809535b934
commit 0df5ebf0fa
3 changed files with 42 additions and 14 deletions

View File

@@ -6,18 +6,25 @@
#ifndef DATA_MEMBERS_DWA2002328_HPP
# define DATA_MEMBERS_DWA2002328_HPP
# include <boost/python/detail/config.hpp>
# include <boost/python/detail/wrap_python.hpp>
# include <boost/type_traits/transform_traits.hpp>
# include <boost/type_traits/add_const.hpp>
# include <boost/type_traits/add_reference.hpp>
# include <boost/python/return_value_policy.hpp>
# include <boost/python/return_by_value.hpp>
# include <boost/python/return_internal_reference.hpp>
# include <boost/python/object/function_object.hpp>
# include <boost/python/arg_from_python.hpp>
# include <boost/python/object/function_object.hpp>
# include <boost/python/converter/builtin_converters.hpp>
# include <boost/python/detail/indirect_traits.hpp>
# include <boost/python/detail/config.hpp>
# include <boost/python/detail/wrap_python.hpp>
# include <boost/type_traits/transform_traits.hpp>
# include <boost/type_traits/add_const.hpp>
# include <boost/type_traits/add_reference.hpp>
# include <boost/mpl/if.hpp>
# include <boost/bind.hpp>
namespace boost { namespace python {
@@ -71,16 +78,21 @@ namespace detail
// and get the right result.
template <class T>
struct default_getter_policy
: mpl::if_c<
to_python_value<
typename add_reference<
typename add_const<T>::type
>::type
>::uses_registry
{
typedef typename add_reference<
typename add_const<T>::type
>::type t_cref;
BOOST_STATIC_CONSTANT(
bool, by_ref = to_python_value<t_cref>::uses_registry
&& is_reference_to_class<t_cref>::value);
typedef typename mpl::if_c<
by_ref
, return_internal_reference<>
, return_value_policy<return_by_value>
>
{};
>::type type;
};
}
template <class C, class D>