Skip to content

Commit 976b818

Browse files
committed
Workaround a VC7 bug with nested enums
[SVN r19611]
1 parent 37acf41 commit 976b818

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

include/boost/python/object_core.hpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@
2727

2828
# include <boost/preprocessor/iterate.hpp>
2929
# include <boost/preprocessor/debug/line.hpp>
30-
# include <boost/python/detail/is_xxx.hpp>
3130

32-
# include <boost/type_traits/is_same.hpp>
31+
# include <boost/python/detail/is_xxx.hpp>
3332
# include <boost/python/detail/string_literal.hpp>
3433
# include <boost/python/detail/def_helper_fwd.hpp>
3534

35+
# include <boost/type_traits/is_same.hpp>
36+
# include <boost/type_traits/is_convertible.hpp>
37+
38+
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
39+
# include <boost/type_traits/add_pointer.hpp>
40+
# endif
41+
3642
namespace boost { namespace python {
3743

3844
namespace converter
@@ -69,8 +75,6 @@ namespace api
6975
//
7076
BOOST_PYTHON_IS_XXX_DEF(proxy, boost::python::api::proxy, 1)
7177

72-
template <class T> struct object_initializer;
73-
7478
class object;
7579
typedef PyObject* (object::*bool_type)() const;
7680

@@ -224,20 +228,14 @@ namespace api
224228
BOOST_DEDUCED_TYPENAME unwrap_reference<T>::type
225229
>::get(
226230
object::do_unforward(x)
227-
, detail::convertible<object const*>::check(
228-
to_ptr(
229-
object::do_unforward(x)
230-
)
231-
)
231+
, is_convertible<T*, object const*>()
232232
))
233233
{
234234
}
235235

236236
// Throw error_already_set() if the handle is null.
237237
BOOST_PYTHON_DECL explicit object(handle<> const&);
238238
private:
239-
template <class T>
240-
static T const* to_ptr(T const&) { return 0; }
241239

242240
template <class T>
243241
typename objects::unforward_cref<T>::type do_unforward(T const& x)
@@ -287,14 +285,14 @@ namespace api
287285
struct object_initializer_impl
288286
{
289287
static PyObject*
290-
get(object const& x, detail::yes_convertible)
288+
get(object const& x, mpl::true_)
291289
{
292290
return python::incref(x.ptr());
293291
}
294292

295293
template <class T>
296294
static PyObject*
297-
get(T const& x, detail::no_convertible)
295+
get(T const& x, mpl::false_)
298296
{
299297
return python::incref(converter::arg_to_python<T>(x).get());
300298
}
@@ -305,7 +303,7 @@ namespace api
305303
{
306304
template <class Policies>
307305
static PyObject*
308-
get(proxy<Policies> const& x, detail::no_convertible)
306+
get(proxy<Policies> const& x, mpl::false_)
309307
{
310308
return python::incref(x.operator object().ptr());
311309
}

0 commit comments

Comments
 (0)