Update contrib.
1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef BACK_REFERENCE_DWA2002510_HPP
6 # define BACK_REFERENCE_DWA2002510_HPP
8 # include <boost/python/detail/prefix.hpp>
10 # include <boost/python/object_fwd.hpp>
11 # include <boost/python/detail/dependent.hpp>
12 # include <boost/python/detail/raw_pyobject.hpp>
14 namespace boost { namespace python {
20 typedef typename detail::dependent<object,T>::type source_t;
24 back_reference(PyObject*, T);
25 source_t const& source() const;
32 # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
34 class is_back_reference
37 BOOST_STATIC_CONSTANT(bool, value = false);
41 class is_back_reference<back_reference<T> >
44 BOOST_STATIC_CONSTANT(bool, value = true);
47 # else // no partial specialization
49 }} // namespace boost::python
51 #include <boost/type.hpp>
53 namespace boost { namespace python {
57 typedef char (&yes_back_reference_t)[1];
58 typedef char (&no_back_reference_t)[2];
60 no_back_reference_t is_back_reference_test(...);
63 yes_back_reference_t is_back_reference_test(boost::type< back_reference<T> >);
67 class is_back_reference
70 BOOST_STATIC_CONSTANT(
72 sizeof(detail::is_back_reference_test(boost::type<T>()))
73 == sizeof(detail::yes_back_reference_t)));
76 # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
82 back_reference<T>::back_reference(PyObject* p, T x)
83 : m_source(detail::borrowed_reference(p))
89 typename back_reference<T>::source_t const& back_reference<T>::source() const
95 T back_reference<T>::get() const
100 }} // namespace boost::python
102 #endif // BACK_REFERENCE_DWA2002510_HPP