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

More cleanups for mpl_v2

[SVN r13516]
This commit is contained in:
Dave Abrahams
2002-04-17 04:34:34 +00:00
parent 4250893d2f
commit a203214ef9
3 changed files with 1 additions and 47 deletions

View File

@@ -1,41 +0,0 @@
// Copyright David Abrahams 2002. Permission to copy, use,
// modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#ifndef COPY_MUTABLE_REFERENCE_DWA2002131_HPP
# define COPY_MUTABLE_REFERENCE_DWA2002131_HPP
# include <boost/python/detail/indirect_traits.hpp>
# include <boost/mpl/select_type.hpp>
# include <boost/python/to_python_value.hpp>
namespace boost { namespace python {
namespace detail
{
template <class R>
struct copy_mutable_reference_expects_a_reference_to_non_const_return_type
# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__)
{}
# endif
;
}
template <class T> struct to_python_value;
struct copy_mutable_reference
{
template <class T>
struct apply
{
typedef typename mpl::select_type<
detail::is_reference_to_non_const<T>::value
, to_python_value<T>
, detail::copy_mutable_reference_expects_a_reference_to_non_const_return_type<T>
>::type type;
};
};
}} // namespace boost::python
#endif // COPY_MUTABLE_REFERENCE_DWA2002131_HPP

View File

@@ -1,6 +1,5 @@
#include <boost/python/module.hpp>
#include <boost/python/class.hpp>
#include <boost/mpl/type_list.hpp>
struct V
{
@@ -15,19 +14,17 @@ struct B
BOOST_PYTHON_MODULE_INIT(bienstman3_ext)
{
using namespace boost::python;
using boost::mpl::type_list;
module m("bienstman3_ext");
m
.add(
class_<V, boost::noncopyable>("V")
)
.add(
class_<B>("B")
.def_init(type_list<const V&>())
.def_init(args<const V&>())
)
;
}

View File

@@ -8,10 +8,8 @@
#include <boost/python/manage_new_object.hpp>
#include <boost/python/return_internal_reference.hpp>
#include <boost/python/class.hpp>
#include <boost/mpl/type_list.hpp>
using namespace boost::python;
using boost::mpl::type_list;
int a_instances = 0;