From 47c1c6288ccd4a92fbb6f856ddf484640897c094 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Feb 2002 05:14:41 +0000 Subject: [PATCH] Added error checking [SVN r12862] --- .../python/return_internal_reference.hpp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/include/boost/python/return_internal_reference.hpp b/include/boost/python/return_internal_reference.hpp index 2f567e55..356bc9ed 100644 --- a/include/boost/python/return_internal_reference.hpp +++ b/include/boost/python/return_internal_reference.hpp @@ -9,14 +9,32 @@ # include # include # include +# include namespace boost { namespace python { +namespace detail +{ + template + struct return_internal_reference_owner_arg_must_be_greater_than_zero +# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) + {} +# endif + ; +} + template struct return_internal_reference : with_custodian_and_ward_postcall<0, owner_arg, Base> { - typedef reference_existing_object result_converter; + private: + BOOST_STATIC_CONSTANT(bool, legal = owner_arg > 0); + public: + typedef typename mpl::select_type< + legal + , reference_existing_object + , detail::return_internal_reference_owner_arg_must_be_greater_than_zero + >::type result_converter; }; }} // namespace boost::python