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 REGISTERED_DWA2002710_HPP
6 # define REGISTERED_DWA2002710_HPP
7 # include <boost/python/type_id.hpp>
8 # include <boost/python/converter/registry.hpp>
9 # include <boost/python/converter/registrations.hpp>
10 # include <boost/type_traits/transform_traits.hpp>
11 # include <boost/type_traits/cv_traits.hpp>
12 # include <boost/type_traits/is_void.hpp>
13 # include <boost/detail/workaround.hpp>
14 # include <boost/python/type_id.hpp>
15 # include <boost/type.hpp>
19 // You'll see shared_ptr mentioned in this header because we need to
20 // note which types are shared_ptrs in their registrations, to
21 // implement special shared_ptr handling for rvalue conversions.
22 template <class T> class shared_ptr;
24 namespace python { namespace converter {
31 struct registered_base
33 static registration const& converters;
39 : detail::registered_base<
40 typename add_reference<
41 typename add_cv<T>::type
47 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
48 && !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
49 // collapses a few more types to the same static instance. MSVC7.1
50 // fails to strip cv-qualification from array types in typeid. For
51 // some reason we can't use this collapse there or array converters
64 register_shared_ptr0(...)
70 register_shared_ptr0(shared_ptr<T>*)
72 registry::lookup_shared_ptr(type_id<shared_ptr<T> >());
77 register_shared_ptr1(T const volatile*)
79 detail::register_shared_ptr0((T*)0);
83 inline registration const&
84 registry_lookup2(T&(*)())
86 detail::register_shared_ptr1((T*)0);
87 return registry::lookup(type_id<T&>());
91 inline registration const&
92 registry_lookup1(type<T>)
94 return registry_lookup2((T(*)())0);
97 inline registration const&
98 registry_lookup1(type<const volatile void>)
100 detail::register_shared_ptr1((void*)0);
101 return registry::lookup(type_id<void>());
105 registration const& registered_base<T>::converters = detail::registry_lookup1(type<T>());
109 }}} // namespace boost::python::converter
111 #endif // REGISTERED_DWA2002710_HPP