1 #ifndef BORROWED_PTR_DWA20020601_HPP
2 # define BORROWED_PTR_DWA20020601_HPP
3 // Copyright David Abrahams 2002.
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 # include <boost/config.hpp>
9 # include <boost/type.hpp>
10 # include <boost/mpl/if.hpp>
11 # include <boost/type_traits/object_traits.hpp>
12 # include <boost/type_traits/cv_traits.hpp>
13 # include <boost/python/tag.hpp>
15 namespace boost { namespace python { namespace detail {
17 template<class T> class borrowed
23 struct is_borrowed_ptr
25 BOOST_STATIC_CONSTANT(bool, value = false);
28 # if !defined(__MWERKS__) || __MWERKS__ > 0x3000
30 struct is_borrowed_ptr<borrowed<T>*>
32 BOOST_STATIC_CONSTANT(bool, value = true);
36 struct is_borrowed_ptr<borrowed<T> const*>
38 BOOST_STATIC_CONSTANT(bool, value = true);
42 struct is_borrowed_ptr<borrowed<T> volatile*>
44 BOOST_STATIC_CONSTANT(bool, value = true);
48 struct is_borrowed_ptr<borrowed<T> const volatile*>
50 BOOST_STATIC_CONSTANT(bool, value = true);
56 BOOST_STATIC_CONSTANT(bool, value = false);
59 struct is_borrowed<borrowed<T> >
61 BOOST_STATIC_CONSTANT(bool, value = true);
64 struct is_borrowed_ptr<T*>
65 : is_borrowed<typename remove_cv<T>::type>
74 inline T* get_managed_object(detail::borrowed<T> const volatile* p, tag_t)
79 }} // namespace boost::python::detail
81 #endif // #ifndef BORROWED_PTR_DWA20020601_HPP