base_type_traits.hpp 878 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 BASE_TYPE_TRAITS_DWA2002614_HPP
  6. # define BASE_TYPE_TRAITS_DWA2002614_HPP
  7. # include <boost/python/detail/prefix.hpp>
  8. namespace boost { namespace python {
  9. namespace detail
  10. {
  11. struct unspecialized {};
  12. }
  13. // Derive from unspecialized so we can detect whether traits are
  14. // specialized
  15. template <class T> struct base_type_traits
  16. : detail::unspecialized
  17. {};
  18. template <>
  19. struct base_type_traits<PyObject>
  20. {
  21. typedef PyObject type;
  22. };
  23. template <>
  24. struct base_type_traits<PyTypeObject>
  25. {
  26. typedef PyObject type;
  27. };
  28. template <>
  29. struct base_type_traits<PyMethodObject>
  30. {
  31. typedef PyObject type;
  32. };
  33. }} // namespace boost::python
  34. #endif // BASE_TYPE_TRAITS_DWA2002614_HPP